diff options
Diffstat (limited to 'clang/test/SemaCXX')
| -rw-r--r-- | clang/test/SemaCXX/extern-c.cpp | 61 | ||||
| -rw-r--r-- | clang/test/SemaCXX/friend.cpp | 2 | ||||
| -rw-r--r-- | clang/test/SemaCXX/linkage-spec.cpp | 43 | ||||
| -rw-r--r-- | clang/test/SemaCXX/linkage2.cpp | 12 |
4 files changed, 18 insertions, 100 deletions
diff --git a/clang/test/SemaCXX/extern-c.cpp b/clang/test/SemaCXX/extern-c.cpp index aacc0ffb158..220b2a8dc1e 100644 --- a/clang/test/SemaCXX/extern-c.cpp +++ b/clang/test/SemaCXX/extern-c.cpp @@ -3,20 +3,20 @@ namespace test1 { extern "C" { void test1_f() { - void test1_g(int); // expected-note {{declared with C language linkage here}} + void test1_g(int); // expected-note {{previous declaration is here}} } } } -int test1_g(int); // expected-error {{declaration of 'test1_g' in global scope conflicts with declaration with C language linkage}} +int test1_g(int); // expected-error {{functions that differ only in their return type cannot be overloaded}} namespace test2 { extern "C" { void test2_f() { - extern int test2_x; // expected-note {{declared with C language linkage here}} + extern int test2_x; // expected-note {{previous definition is here}} } } } -float test2_x; // expected-error {{declaration of 'test2_x' in global scope conflicts with declaration with C language linkage}} +float test2_x; // expected-error {{redefinition of 'test2_x' with a different type: 'float' vs 'int'}} namespace test3 { extern "C" { @@ -31,18 +31,18 @@ namespace test3 { extern "C" { void test4_f() { - extern int test4_b; // expected-note {{declared with C language linkage here}} + extern int test4_b; // expected-note {{previous definition is here}} } } -static float test4_b; // expected-error {{declaration of 'test4_b' in global scope conflicts with declaration with C language linkage}} +static float test4_b; // expected-error {{redefinition of 'test4_b' with a different type: 'float' vs 'int'}} extern "C" { void test5_f() { - extern int test5_b; // expected-note {{declared with C language linkage here}} + extern int test5_b; // expected-note {{previous definition is here}} } } extern "C" { - static float test5_b; // expected-error {{declaration of 'test5_b' in global scope conflicts with declaration with C language linkage}} + static float test5_b; // expected-error {{redefinition of 'test5_b' with a different type: 'float' vs 'int'}} } extern "C" { @@ -69,11 +69,11 @@ namespace linkage { } } namespace from_outer { - void linkage_from_outer_1(); // expected-note {{previous}} + void linkage_from_outer_1(); void linkage_from_outer_2(); // expected-note {{previous}} extern "C" { - void linkage_from_outer_1(int); - void linkage_from_outer_1(); // expected-error {{different language linkage}} + void linkage_from_outer_1(int); // expected-note {{previous}} + void linkage_from_outer_1(); // expected-error {{conflicting types}} void linkage_from_outer_2(); // expected-error {{different language linkage}} } } @@ -98,44 +98,11 @@ namespace linkage { } } -void lookup_in_global_f(); // expected-note {{here}} +void lookup_in_global_f(); namespace lookup_in_global { void lookup_in_global_f(); - void lookup_in_global_g(); extern "C" { - void lookup_in_global_f(int); // expected-error {{conflicts with declaration in global scope}} - void lookup_in_global_g(int); // expected-note {{here}} + // FIXME: We should reject this. + void lookup_in_global_f(int); } } -void lookup_in_global_g(); // expected-error {{conflicts with declaration with C language linkage}} - -namespace N1 { - extern "C" int different_kind_1; // expected-note {{here}} - extern "C" void different_kind_2(); // expected-note {{here}} -} -namespace N2 { - extern "C" void different_kind_1(); // expected-error {{different kind of symbol}} - extern "C" int different_kind_2; // expected-error {{different kind of symbol}} -} - -extern "C" { - struct stat {}; - void stat(struct stat); -} -namespace X { - extern "C" { - void stat(struct ::stat); - } -} - -extern "C" void name_with_using_decl_1(int); -namespace using_decl { - void name_with_using_decl_1(); - void name_with_using_decl_2(); - void name_with_using_decl_3(); -} -using using_decl::name_with_using_decl_1; -using using_decl::name_with_using_decl_2; -extern "C" void name_with_using_decl_2(int); -extern "C" void name_with_using_decl_3(int); -using using_decl::name_with_using_decl_3; diff --git a/clang/test/SemaCXX/friend.cpp b/clang/test/SemaCXX/friend.cpp index ce2f34ff6b9..5daadf0e729 100644 --- a/clang/test/SemaCXX/friend.cpp +++ b/clang/test/SemaCXX/friend.cpp @@ -134,7 +134,7 @@ namespace test6_3 { namespace test7 { extern "C" { class X { - friend int test7_f() { return 42; } + friend int f() { return 42; } }; } } diff --git a/clang/test/SemaCXX/linkage-spec.cpp b/clang/test/SemaCXX/linkage-spec.cpp index 355a8787931..fc14081247a 100644 --- a/clang/test/SemaCXX/linkage-spec.cpp +++ b/clang/test/SemaCXX/linkage-spec.cpp @@ -41,32 +41,20 @@ namespace pr5430 { using namespace pr5430; extern "C" void pr5430::func(void) { } -// PR5405 -int f2(char *) // expected-note {{here}} +// PR5404 +int f2(char *) { return 0; } extern "C" { - int f2(int) // expected-error {{with C language linkage conflicts with declaration in global scope}} + int f2(int) { return f2((char *)0); } } -namespace PR5405 { - int f2b(char *) { - return 0; - } - - extern "C" { - int f2b(int) { - return f2b((char *)0); // ok - } - } -} - // PR6991 extern "C" typedef int (*PutcFunc_t)(int); @@ -129,28 +117,3 @@ namespace pr14958 { extern "C" void PR16167; // expected-error {{variable has incomplete type 'void'}} extern void PR16167_0; // expected-error {{variable has incomplete type 'void'}} - -// PR7927 -enum T_7927 { - E_7927 -}; - -extern "C" void f_pr7927(int); - -namespace { - extern "C" void f_pr7927(int); - - void foo_pr7927() { - f_pr7927(E_7927); - f_pr7927(0); - ::f_pr7927(E_7927); - ::f_pr7927(0); - } -} - -void bar_pr7927() { - f_pr7927(E_7927); - f_pr7927(0); - ::f_pr7927(E_7927); - ::f_pr7927(0); -} diff --git a/clang/test/SemaCXX/linkage2.cpp b/clang/test/SemaCXX/linkage2.cpp index c97a2f4ba74..a811575c612 100644 --- a/clang/test/SemaCXX/linkage2.cpp +++ b/clang/test/SemaCXX/linkage2.cpp @@ -201,15 +201,3 @@ namespace test18 { } void *h() { return f(); } } - -extern "C" void pr16247_foo(int); // expected-note {{here}} -static void pr16247_foo(double); // expected-error {{conflicts with declaration with C language linkage}} -void pr16247_foo(int) {} -void pr16247_foo(double) {} - -namespace PR16247 { - extern "C" void pr16247_bar(int); - static void pr16247_bar(double); - void pr16247_bar(int) {} - void pr16247_bar(double) {} -} |

