-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Description
The lit test "clang/test/CodeGenCXX/override-layout-nameless-struct-union.cpp" fails when C++ Modules are enabled. We encountered this internally because we have set the default dialect to C++20 for PlayStation, exposing this problem.
The test case includes the following code:
// RUN: %clang_cc1 -w -fdump-record-layouts-simple -foverride-record-layout=%S/Inputs/override-layout-nameless-struct-union.layout %s | FileCheck %s
// CHECK: Type: struct S
// CHECK: Size:64
// CHECK: Alignment:32
// CHECK: FieldOffsets: [0, 32, 32]
struct S {
short _s;
//union {
int _su0;
char _su1;
//};
};
It is an attempt to compile this struct with a non-standard layout specified in the input file.
However, if modules are enabled (either explicitly via -fmodules or implicitly via -std=c++20, or that being the default of the compiler) that layout file is never read, leading to the test failure.
It appears to be a bug in the order of operations in clang/lib/Frontend/FrontEndAction.cpp in presence of modules.
This isn't urgent for us, because we are working around it by suppressing C++ Modules via adding the switch -fno-cxx-modules in the test's RUN line. But regardless, I thought I should report it