[Issue 19735] New: Error: variab extern symbols cannot have initializers
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Mar 13 10:46:59 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=19735
Issue ID: 19735
Summary: Error: variab extern symbols cannot have initializers
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: critical
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: ibuclaw at gdcproject.org
Similar to issue 19734, but emphasis on the effect on user code, not the
blatant implementation bug.
Given the following example:
extern
{
int f1(int a) { return a + 2; }
int f2(int a) { int b = 42; return a + b; }
}
You get the error during compilation of f2:
Error: variable `b` extern symbols cannot have initializers
As has already been established in 19734, even the parameter `a` is considered
an extern symbol. However, the function `f1` compiles and a body is emitted
without complaint.
Either `f1` should also be considered an error, or `f2` should be fixed to
become valid code.
--
More information about the Digitalmars-d-bugs
mailing list