summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/overloadable.c
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-06-30 09:48:50 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-06-30 09:48:50 +0000
commitac974a3c76fbe2cc9d05adde3455ef42abd18d95 (patch)
treec654e46ea179c497f8b55942f387588b518c35cc /clang/test/Sema/overloadable.c
parent7aa8c2fd99545c2c4357751dcdf515c812d54c98 (diff)
downloadbcm5719-llvm-ac974a3c76fbe2cc9d05adde3455ef42abd18d95.tar.gz
bcm5719-llvm-ac974a3c76fbe2cc9d05adde3455ef42abd18d95.zip
Reinstate r185229, reverted in r185256, with a tweak: further ignore the
standard's rule that an extern "C" declaration conflicts with any entity in the global scope with the same name. Now we only care if the global scope entity is a variable declaration (and so might have the same mangled name as the extern "C" declaration). This has been reported as a standard defect. Original commit message: PR7927, PR16247: Reimplement handling of matching extern "C" declarations across scopes. When we declare an extern "C" name that is not a redeclaration of an entity in the same scope, check whether it redeclares some extern "C" entity from another scope, and if not, check whether it conflicts with a (non-extern-"C") entity in the translation unit. When we declare a name in the translation unit that is not a redeclaration, check whether it conflicts with any extern "C" entities (possibly from other scopes). llvm-svn: 185281
Diffstat (limited to 'clang/test/Sema/overloadable.c')
-rw-r--r--clang/test/Sema/overloadable.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/Sema/overloadable.c b/clang/test/Sema/overloadable.c
index 5d39f15ec81..ad021898f2a 100644
--- a/clang/test/Sema/overloadable.c
+++ b/clang/test/Sema/overloadable.c
@@ -69,3 +69,18 @@ void test() {
f0();
f1();
}
+
+void before_local_1(int) __attribute__((overloadable)); // expected-note {{here}}
+void before_local_2(int); // expected-note {{here}}
+void before_local_3(int) __attribute__((overloadable));
+void local() {
+ void before_local_1(char); // expected-error {{must have the 'overloadable' attribute}}
+ void before_local_2(char) __attribute__((overloadable)); // expected-error {{conflicting types}}
+ void before_local_3(char) __attribute__((overloadable));
+ void after_local_1(char); // expected-note {{here}}
+ void after_local_2(char) __attribute__((overloadable)); // expected-note {{here}}
+ void after_local_3(char) __attribute__((overloadable));
+}
+void after_local_1(int) __attribute__((overloadable)); // expected-error {{conflicting types}}
+void after_local_2(int); // expected-error {{must have the 'overloadable' attribute}}
+void after_local_3(int) __attribute__((overloadable));
OpenPOWER on IntegriCloud