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

pineapple via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Aug 18 07:03:50 PDT 2016


On Thursday, 18 August 2016 at 11:43:03 UTC, Lodovico Giaretta 
wrote:
> 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.

Wouldn't this be more syntactically consistent if it were "Cpp" 
instead of "C++"?


More information about the Digitalmars-d-learn mailing list