https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123810
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |nshead at gcc dot gnu.org
--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Reduced testcase for the modules issue:
cat hello-1_a.C
// { dg-module-do run }
// { dg-additional-options -fmodules-ts }
// { dg-skip-if "requires hosted libstdc++ for iostream" { ! hostedlib } }
module;
#include "hello.h"
export module hello;
// { dg-module-cmi hello }
export void greeter (S)
{
}
cat hello-1_b.C
// { dg-additional-options -fmodules-ts }
#include "hello.h"
import hello;
int main (void)
{
greeter (S {});
return 0;
}
cat hello.h
typedef struct { int m; } M;
struct S { M m; };
./cc1plus hello-1_a.C -nostdinc++ -fmessage-length=0 -std=c++26
-pedantic-errors -Wno-long-long -fmodules -o hello-1_a.s -freflection -quiet
./cc1plus -quiet -nostdinc++ hello-1_b.C -quiet -pedantic-errors -Wno-long-long
-std=c++26 -fmessage-length=0 -fmodules -o hello-1_b.s -freflection
In file included from hello-1_a.C:6,
of module hello, imported at hello-1_b.C:4:
hello.h: In function ‘int main()’:
hello.h:1:27: error: conflicting imported declaration ‘typedef struct M M’
1 | typedef struct { int m; } M;
| ^
In file included from hello-1_b.C:3:
hello.h:1:27: note: existing declaration ‘typedef struct M M’
1 | typedef struct { int m; } M;
| ^
hello-1_b.C:7:3: note: during load of binding ‘::greeter@hello’
7 | greeter (S {});
| ^~~~~~~
with the patch. Without -freflection it compiles fine.