The compiler segfaults compiling this invalid code: -------------------- class C { extern(C++): static int var; // C++ variable should be error } -------------------- The segfault happend in cpp_mangle_name() (cppmangle.c): -------------------- FuncDeclaration *fd = s->isFuncDeclaration(); if (fd->isConst()) <-- HERE buf->writeByte('K'); --------------------
I can't reproduce this. It works for me on Windows. Is it Linux only, or is something missing from the test case?
(In reply to comment #1) > I can't reproduce this. It works for me on Windows. Is it Linux only, or is > something missing from the test case? It's Linux only. On Linux, C++ name mangling is done by the front end. The front end assumes that extern(C++) is applied only to a function, and segfaults when extern(C++) is applied to a static variable. On Windows, C++ name mangling is done by the backend, which can deal with C++ variable name mangling.
Patch: cpp_mangle.c, cpp_mangle_name(), line 112. FuncDeclaration *fd = s->isFuncDeclaration(); + if (!fd) + { + s->error("cannot be declared as extern(C++)"); + return; + } if (fd->isConst()) buf->writeByte('K');
http://www.dsource.org/projects/dmd/changeset/647
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル