mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 21:21:48 +03:00
Fix Bugzilla 24365 - ICE when printing showCtfeContext error (#16131)
This commit is contained in:
parent
d318d9a534
commit
c0101e095e
2 changed files with 22 additions and 1 deletions
|
@ -1343,9 +1343,10 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
|
|||
dsym._init = dsym._init.initializerSemantic(sc, dsym.type, sc.intypeof == 1 ? INITnointerpret : INITinterpret);
|
||||
import dmd.semantic2 : lowerStaticAAs;
|
||||
lowerStaticAAs(dsym, sc);
|
||||
const init_err = dsym._init.isExpInitializer();
|
||||
auto init_err = dsym._init.isExpInitializer();
|
||||
if (init_err && init_err.exp.op == EXP.showCtfeContext)
|
||||
{
|
||||
init_err.exp = ErrorExp.get();
|
||||
errorSupplemental(dsym.loc, "compile time context created here");
|
||||
}
|
||||
}
|
||||
|
|
20
compiler/test/fail_compilation/test24365.d
Normal file
20
compiler/test/fail_compilation/test24365.d
Normal file
|
@ -0,0 +1,20 @@
|
|||
// https://issues.dlang.org/show_bug.cgi?id=243645
|
||||
|
||||
/*
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/test24365.d(16): Error: `f` cannot be interpreted at compile time, because it has no available source code
|
||||
fail_compilation/test24365.d(14): compile time context created here
|
||||
fail_compilation/test24365.d(19): while evaluating: `static assert(r == 2)`
|
||||
---
|
||||
*/
|
||||
|
||||
void main()
|
||||
{
|
||||
enum r = () {
|
||||
void f();
|
||||
f();
|
||||
return 2;
|
||||
}();
|
||||
static assert(r == 2);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue