diff options
author | dim <dim@FreeBSD.org> | 2013-04-08 18:45:10 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2013-04-08 18:45:10 +0000 |
commit | c72c57c9e9b69944e3e009cd5e209634839581d3 (patch) | |
tree | 4fc2f184c499d106f29a386c452b49e5197bf63d /test/SemaCXX/extern-c.cpp | |
parent | 5b20025c30d23d521e12c1f33ec8fa6b821952cd (diff) | |
download | FreeBSD-src-c72c57c9e9b69944e3e009cd5e209634839581d3.zip FreeBSD-src-c72c57c9e9b69944e3e009cd5e209634839581d3.tar.gz |
Vendor import of clang trunk r178860:
http://llvm.org/svn/llvm-project/cfe/trunk@178860
Diffstat (limited to 'test/SemaCXX/extern-c.cpp')
-rw-r--r-- | test/SemaCXX/extern-c.cpp | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/test/SemaCXX/extern-c.cpp b/test/SemaCXX/extern-c.cpp new file mode 100644 index 0000000..c55b10d --- /dev/null +++ b/test/SemaCXX/extern-c.cpp @@ -0,0 +1,58 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +namespace test1 { + extern "C" { + void f() { + void test1_g(int); // expected-note {{previous declaration is here}} + } + } +} +int test1_g(int); // expected-error {{functions that differ only in their return type cannot be overloaded}} + +namespace test2 { + extern "C" { + void f() { + extern int test2_x; // expected-note {{previous definition is here}} + } + } +} +float test2_x; // expected-error {{redefinition of 'test2_x' with a different type: 'float' vs 'int'}} + +namespace test3 { + extern "C" { + void f() { + extern int test3_b; // expected-note {{previous definition is here}} + } + } + extern "C" { + float test3_b; // expected-error {{redefinition of 'test3_b' with a different type: 'float' vs 'int'}} + } +} + +extern "C" { + void test4_f() { + extern int test4_b; // expected-note {{previous definition is here}} + } +} +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 {{previous definition is here}} + } +} +extern "C" { + static float test5_b; // expected-error {{redefinition of 'test5_b' with a different type: 'float' vs 'int'}} +} + +extern "C" { + void f() { + extern int test6_b; + } +} +namespace foo { + extern "C" { + static float test6_b; + extern float test6_b; + } +} |