-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
c++/modules: Propagate some missing flags on type definitions
Noticed while testing my fix for PR c++/113814. Not all of these are easily testable but I've tested a couple that were straight-forward. For consistency also adds a new TYPE_WARN_IF_NOT_ALIGN_RAW flag to match the decl version Nathan added. gcc/cp/ChangeLog: * module.cc (trees_in::read_class_def): Propagate some missing flags from the streamed-in definition. gcc/ChangeLog: * tree.h (TYPE_WARN_IF_NOT_ALIGN_RAW): New accessor. (TYPE_WARN_IF_NOT_ALIGN): Use it. (SET_TYPE_WARN_IF_NOT_ALIGN): Likewise. gcc/testsuite/ChangeLog: * g++.dg/modules/class-10_a.H: New test. * g++.dg/modules/class-10_b.C: New test. Signed-off-by: Nathaniel Shead <[email protected]>
- Loading branch information
Showing
4 changed files
with
49 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// { dg-additional-options "-fmodule-header" } | ||
// { dg-module-cmi {} } | ||
|
||
struct alignas(16) Align {}; | ||
struct Final final {}; | ||
struct NeedsConstructing { NeedsConstructing(); }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// { dg-additional-options "-fmodules-ts -Wno-pedantic" } | ||
// Test bits and pieces of merging information | ||
// from class defs into forward declarations | ||
|
||
struct Align; | ||
struct Final; | ||
struct NeedsConstructing; | ||
|
||
import "class-10_a.H"; | ||
|
||
static_assert(alignof(Align) == 16); | ||
|
||
struct TestFinal : Final {}; // { dg-error "cannot derive" } | ||
|
||
struct TestNeedsConstructing { | ||
struct { | ||
NeedsConstructing a; // { dg-error "with constructor not allowed in anonymous aggregate" } | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters