The following causes the compiler to crash (both 1.031 and 2.015): class C { template Bar() { } } static assert(!is(typeof(C.Bar.foo))); // Should pass
Though the code above is valid, I'm marking this as ice-on-invalid-code because the root cause of it is that the compiler crashes trying to make sense of the invalid typeof. class C { template Bar() { } } typeof(C.Bar.foo) quux;
The segfault is caused by this line in DotIdExp::semantic(Scope *sc) in expression.c, line 5348 (in DMD 2.027). Type *t1b = e1->type->toBasetype(); If the expression was invalid, e1->type is null, so it segfaults. Adding a line like: if (!e1->type) {error("invalid expression"); return e1;} before line 5348 is sufficient to avoid the segfault, and the original valid code will compile without error. Not sure what the error message should be, though.
Fixed DMD2.028, not yet fixed in D1.
*** Bug 1340 has been marked as a duplicate of this bug. ***
This is actually the same as bug 1340. The typeof() isn't necessary. The error message should be something like: "Uninstantiated templates have no members". Reduced test case, ultimately from bug 1340: struct C { template Bar() {} } void main() { C.Bar.foo(); }
Fixed dmd 1.044
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル