Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing source location for betterC TypeInfo error #3631

Closed
DaveP1776 opened this issue Dec 13, 2020 · 1 comment
Closed

Missing source location for betterC TypeInfo error #3631

DaveP1776 opened this issue Dec 13, 2020 · 1 comment

Comments

@DaveP1776
Copy link
Contributor

Output of ldc2 --version:

LDC - the LLVM D compiler (1.24.0):                                                   
  based on DMD v2.094.1 and LLVM 11.0.0
  built with LDC - the LLVM D compiler (1.24.0)                                           
  Default target: x86_64-unknown-linux-gnu 
...

A minimal program, compiled with -betterC:

extern(C) int main(){
    int[] foo = [1];
    return 0;
}

Yields the error message:

Error: TypeInfo cannot be used with -betterC

With dmd, the error message is:

bug.d(2): Error: TypeInfo cannot be used with -betterC

In other words, the error message indicates file and line.

This can be quite frustrating in larger source files.

It looks like this happens because a default constructed Loc is passed into getOrCreateTypeInfoDeclaration at https://github.com/ldc-developers/ldc/blob/master/gen/llvmhelpers.cpp#L1200

kinke added a commit to DaveP1776/ldc that referenced this issue Dec 13, 2020
@kinke
Copy link
Member

kinke commented Dec 14, 2020

Fixed by #3632.

@kinke kinke closed this as completed Dec 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants