diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2025-07-29 08:20:59 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-29 08:20:59 -0400 |
commit | 315e2e28b13285a352d409b739ba31fb453d661b (patch) | |
tree | d319f8e097fb80474894c8e759b1b31b568538b1 /clang/test/Modules/ModuleModuleDebugInfo.cpp | |
parent | 3ede2decbe271270e081e31ce26e3acd42de2f2c (diff) | |
download | llvm-315e2e28b13285a352d409b739ba31fb453d661b.zip llvm-315e2e28b13285a352d409b739ba31fb453d661b.tar.gz llvm-315e2e28b13285a352d409b739ba31fb453d661b.tar.bz2 |
[C23] Handle type compatibility for enumerations better (#150282)
An enumeration is compatible with its underlying type, which means that
code like the following should be accepted:
struct A { int h; };
void func() {
extern struct A x;
enum E : int { e };
struct A { enum E h; };
extern struct A x;
}
because the structures are declared in different scopes, the two
declarations of 'x' are both compatible.
Note, the structural equivalence checker does not take scope into
account, but that is something the C standard requires. This means we
are accepting code we should be rejecting per the standard, like:
void func() {
struct A { int h; };
extern struct A x;
enum E : int { e };
struct A { enum E h; };
extern struct A x;
}
Because the structures are declared in the same scope, the type
compatibility rule require the structures to use the same types, not
merely compatible ones.
Fixes #149965
Diffstat (limited to 'clang/test/Modules/ModuleModuleDebugInfo.cpp')
0 files changed, 0 insertions, 0 deletions