Debian Codegraph @

gcc/testsuite/g++.dg/modules/lang-4_b.C

raw
1 // PR c++/122019
2 // { dg-additional-options "-fmodules -Wno-global-module" }
3 // Language linkage for types, variables, and lazy-loading in extern contexts.
4
5 module;
6
7 extern "C" enum E { c };
8 extern "C++" typedef int T;
9
10 extern "C++" int foo; // { dg-message "existing" }
11 extern "C" int bar; // { dg-message "existing" }
12
13 module M;
14
15 extern "C" ns::pthread_once_t x;
16
17 E e;
18 T t;
19
20 extern "C" { int use1 = foo; } // { dg-message "during load" }
21 extern "C" { int use2 = bar; } // { dg-message "during load" }
22 // { dg-error "conflicting language linkage for imported declaration 'int foo'" "" { target *-*-* } 0 }
23 // { dg-error "conflicting language linkage for imported declaration 'int bar'" "" { target *-*-* } 0 }
24
25 extern "C++" int qux; // { dg-error "conflicting declaration" }
26 extern "C" int zap; // { dg-error "conflicting declaration" }