compile error while use `extern(C++, class)`

Lodovico Giaretta via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Aug 18 04:43:03 PDT 2016


On Thursday, 18 August 2016 at 11:11:10 UTC, mogu wrote:
> On Thursday, 18 August 2016 at 10:45:14 UTC, Lodovico Giaretta 
> wrote:
>>
>> Which kind of error? An error message by the compiler? One by 
>> the linker? The compiler crashes?
>>
>
> Compiler Error exactly. The minimal code is(dmd or ldc2 in 
> ubuntu 16.04 lts):
> ```
> extern (C++, struct)
> class A {}
> ```
>
> Error: identifier expected for C++ namespace found 'struct' 
> when expecting ')' declaration expected, not ')'

Which compiler version are you using? On DMD 2.071.0 this does 
not work. On nightly build it compiles without errors. So 
probably it is a feature that is present, but didn't ship yet. I 
suggest you download the latest beta or a nightly build from the 
site.


More information about the Digitalmars-d-learn mailing list