diff options
Diffstat (limited to 'clang/test/SemaCXX/extern-c.cpp')
-rw-r--r-- | clang/test/SemaCXX/extern-c.cpp | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/clang/test/SemaCXX/extern-c.cpp b/clang/test/SemaCXX/extern-c.cpp index 30b8fe69a97..2bf95352259 100644 --- a/clang/test/SemaCXX/extern-c.cpp +++ b/clang/test/SemaCXX/extern-c.cpp @@ -29,16 +29,27 @@ namespace test3 { } } -extern "C" { - void test4_f() { - extern int test4_b; // expected-note {{declared with C language linkage here}} +namespace N { + extern "C" { + void test4_f() { + extern int test4_b; // expected-note {{declared with C language linkage here}} + } } } static float test4_b; // expected-error {{declaration of 'test4_b' in global scope conflicts with declaration with C language linkage}} extern "C" { - void test5_f() { - extern int test5_b; // expected-note {{declared with C language linkage here}} + void test4c_f() { + extern int test4_c; // expected-note {{previous}} + } +} +static float test4_c; // expected-error {{redefinition of 'test4_c' with a different type: 'float' vs 'int'}} + +namespace N { + extern "C" { + void test5_f() { + extern int test5_b; // expected-note {{declared with C language linkage here}} + } } } extern "C" { @@ -46,6 +57,15 @@ extern "C" { } extern "C" { + void test5c_f() { + extern int test5_c; // expected-note {{previous}} + } +} +extern "C" { + static float test5_c; // expected-error {{redefinition of 'test5_c' with a different type: 'float' vs 'int'}} +} + +extern "C" { void f() { extern int test6_b; } |