summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-11-25 22:24:25 +0000
committerDouglas Gregor <dgregor@apple.com>2009-11-25 22:24:25 +0000
commitf73b282bf0391374c8dbf71d81ea5541cb3e1a74 (patch)
tree080e5b3ffed95e73306fb450368f937abb6f4ed2 /clang/test
parente6929ffc21fdb77941cfa48fd3bb0f719adf76fe (diff)
downloadbcm5719-llvm-f73b282bf0391374c8dbf71d81ea5541cb3e1a74.tar.gz
bcm5719-llvm-f73b282bf0391374c8dbf71d81ea5541cb3e1a74.zip
Implement the rules in C++ [basic.link] and C99 6.2.2 for computing
the linkage of a declaration. Switch the lame (and completely wrong) NamedDecl::hasLinkage() over to using the new NamedDecl::getLinkage(), along with the "can this declaration be a template argument?" check that started all of this. Fixes -fsyntax-only for PR5597. llvm-svn: 89891
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CXX/basic/basic.link/p9.cpp11
-rw-r--r--clang/test/SemaCXX/nested-name-spec.cpp1
-rw-r--r--clang/test/SemaTemplate/temp_arg_nontype.cpp9
3 files changed, 20 insertions, 1 deletions
diff --git a/clang/test/CXX/basic/basic.link/p9.cpp b/clang/test/CXX/basic/basic.link/p9.cpp
new file mode 100644
index 00000000000..ecff3eebafe
--- /dev/null
+++ b/clang/test/CXX/basic/basic.link/p9.cpp
@@ -0,0 +1,11 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+
+// FIXME: This test is woefully incomplete.
+namespace N { } // expected-note{{here}}
+
+// First bullet: two names with external linkage that refer to
+// different kinds of entities.
+void f() {
+ int N(); // expected-error{{redefinition}}
+}
+
diff --git a/clang/test/SemaCXX/nested-name-spec.cpp b/clang/test/SemaCXX/nested-name-spec.cpp
index 721758f4cae..883f039fe47 100644
--- a/clang/test/SemaCXX/nested-name-spec.cpp
+++ b/clang/test/SemaCXX/nested-name-spec.cpp
@@ -87,7 +87,6 @@ void f3() {
N::x = 0; // expected-error {{expected a class or namespace}}
{ int A; A::ax = 0; }
{ typedef int A; A::ax = 0; } // expected-error{{expected a class or namespace}}
- { int A(); A::ax = 0; }
{ typedef A::C A; A::ax = 0; } // expected-error {{no member named 'ax'}}
{ typedef A::C A; A::cx = 0; }
}
diff --git a/clang/test/SemaTemplate/temp_arg_nontype.cpp b/clang/test/SemaTemplate/temp_arg_nontype.cpp
index bde92be93df..0c44651ccfe 100644
--- a/clang/test/SemaTemplate/temp_arg_nontype.cpp
+++ b/clang/test/SemaTemplate/temp_arg_nontype.cpp
@@ -151,3 +151,12 @@ namespace ns {
Baz<static_cast<ns::E>(0)> b2; // This neither.
}
+// PR5597
+template<int (*)(float)> struct X0 { };
+
+struct X1 {
+ static int pfunc(float);
+};
+void test_X0_X1() {
+ X0<X1::pfunc> x01;
+}
OpenPOWER on IntegriCloud