On 30 April 2018 at 20:02, Freddie Chopin wrote:
> Here's a minimal test case:
>
> -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 --
>
> $ cat test.cpp
>
> extern "C"
> {
>
> void f1()
> {
> union some_type{
> char a[2];
> int b;
> } variable;
> }
>
> void f2()
> {
> union some_type{
> char a[2];
> int b;
> } variable;
> }
>
> }
>
> $ arm-none-eabi-gcc test.cpp -c
> test.cpp: In function 'void f2()':
> test.cpp:17:5: warning: conflicting C language linkage declaration
> 'f2()::some_type variable'
> } variable;
> ^~~~~~~~
> test.cpp:9:5: note: previous declaration 'f1()::some_type variable'
> } variable;
> ^~~~~~~~
This warning started with https://gcc.gnu.org/r253622
[C++ PATCH] hash-table for extern-c fns.
https://gcc.gnu.org/ml/gcc-patches/2017-10/msg00614.html
* name-lookup.c (extern_c_fns): Rename to ...
(extern_c_decls): ... here.
(check_extern_c_conflict, extern_c_linkage_bindings): Update.
(do_pushdecl): Check extern-c fns and vars.
* g++.dg/lookup/extern-c-redecl6.C: New.
* g++.dg/lookup/extern-c-hidden.C: Adjust diagnostics.
* g++.dg/lookup/extern-c-redecl.C: Likewise.
* g++.old-deja/g++.other/using9.C: Likewise.
Nathan, is this a regression for this testcase? IIUC the local types
and the local variables should have no linkage, and not conflict.