d: Set TYPE_ARTIFICIAL on internal TypeInfo types

Prevents them from triggering warnings when compiling with `-Wpadded'.

gcc/d/ChangeLog:

	* typeinfo.cc (make_internal_typeinfo): Set TYPE_ARTIFICIAL.

gcc/testsuite/ChangeLog:

	* gdc.dg/Wpadded.d: New test.
This commit is contained in:
Iain Buclaw 2022-06-15 13:20:15 +02:00
parent 8c2733e16e
commit 57b2adae53
2 changed files with 5 additions and 0 deletions

View File

@ -180,6 +180,7 @@ make_internal_typeinfo (tinfo_kind tk, Identifier *ident, ...)
/* Create the TypeInfo type. */
tree type = make_node (RECORD_TYPE);
TYPE_ARTIFICIAL (type) = 1;
finish_builtin_struct (type, ident->toChars (), fields, NULL_TREE);
tinfo_types[tk] = type;

View File

@ -0,0 +1,4 @@
// { dg-do compile }
// { dg-options "-Wpadded" }
class EmptyClass { }