mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 21:21:48 +03:00

Issue 20339: isPOD returns true if sizeof is accessed inside struct declaration Issue 24292: Struct with destructor wrongly returned in register Function StructDeclaration.isPOD can be called before the semantic run for the struct is finished. It then uses incomplete information about destructors, postblits and copy constructors. The result of isPOD is cached, so later calls will also return the wrong result. This commit changes isPOD, so it uses variables, which are already filled before the semantic run.
44 lines
485 B
D
44 lines
485 B
D
/*
|
|
TEST_OUTPUT:
|
|
---
|
|
4
|
|
false
|
|
false
|
|
---
|
|
*/
|
|
|
|
// https://issues.dlang.org/show_bug.cgi?id=20339
|
|
|
|
struct S
|
|
{
|
|
pragma(msg, cast(int)S.sizeof);
|
|
|
|
this(this){}
|
|
~this(){}
|
|
|
|
int f;
|
|
}
|
|
|
|
static assert(__traits(isPOD, S) == false);
|
|
|
|
|
|
pragma(msg, __traits(isPOD, T));
|
|
|
|
struct T
|
|
{
|
|
this(this){}
|
|
~this(){}
|
|
}
|
|
|
|
static assert(__traits(isPOD, T) == false);
|
|
|
|
|
|
struct U
|
|
{
|
|
pragma(msg, __traits(isPOD, U));
|
|
|
|
this(this){}
|
|
~this(){}
|
|
}
|
|
|
|
static assert(__traits(isPOD, U) == false);
|