mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 05:00:16 +03:00
fix Issue 23439 - [REG 2.098] Error: CTFE internal error: literal 'assert(false, "Accessed expression of type noreturn")' (#14596)
This commit is contained in:
parent
020d7c216b
commit
048be13548
3 changed files with 27 additions and 0 deletions
|
@ -2867,6 +2867,12 @@ public:
|
|||
else
|
||||
m = v.getConstInitializer(true);
|
||||
}
|
||||
else if (v.type.isTypeNoreturn())
|
||||
{
|
||||
// Noreturn field with default initializer
|
||||
(*elems)[fieldsSoFar + i] = null;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
m = v.type.defaultInitLiteral(e.loc);
|
||||
if (exceptionOrCant(m))
|
||||
|
|
8
compiler/test/compilable/test23439.d
Normal file
8
compiler/test/compilable/test23439.d
Normal file
|
@ -0,0 +1,8 @@
|
|||
// https://issues.dlang.org/show_bug.cgi?id=23439
|
||||
// PERMUTE_ARGS: -lowmem
|
||||
class C23439
|
||||
{
|
||||
noreturn f23439;
|
||||
}
|
||||
|
||||
__gshared ice23439 = new C23439();
|
13
compiler/test/fail_compilation/fail23439.d
Normal file
13
compiler/test/fail_compilation/fail23439.d
Normal file
|
@ -0,0 +1,13 @@
|
|||
// https://issues.dlang.org/show_bug.cgi?id=23439
|
||||
// PERMUTE_ARGS: -lowmem
|
||||
/* TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/fail23439.d(13): Error: variable `fail23439.ice23439` is a thread-local class and cannot have a static initializer. Use `static this()` to initialize instead.
|
||||
---
|
||||
*/
|
||||
class C23439
|
||||
{
|
||||
noreturn f23439;
|
||||
}
|
||||
|
||||
static ice23439 = new C23439();
|
Loading…
Add table
Add a link
Reference in a new issue