diff options
Diffstat (limited to 'test/SemaCXX/linkage2.cpp')
-rw-r--r-- | test/SemaCXX/linkage2.cpp | 55 |
1 files changed, 52 insertions, 3 deletions
diff --git a/test/SemaCXX/linkage2.cpp b/test/SemaCXX/linkage2.cpp index 3cfa981..075f5e7 100644 --- a/test/SemaCXX/linkage2.cpp +++ b/test/SemaCXX/linkage2.cpp @@ -1,5 +1,6 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -// RUN: %clang_cc1 -fsyntax-only -verify -fmodules %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=gnu++11 %s +// RUN: %clang_cc1 -fsyntax-only -verify -Wno-c++11-extensions -Wno-local-type-template-args %s +// RUN: %clang_cc1 -fsyntax-only -verify -Wno-c++11-extensions -Wno-local-type-template-args -fmodules %s namespace test1 { int x; // expected-note {{previous definition is here}} @@ -65,7 +66,7 @@ namespace test6 { get_future(); template <class _Rp> struct shared_future<_Rp&> { - shared_future(future<_Rp&>&& __f); // expected-warning {{rvalue references are a C++11 extension}} + shared_future(future<_Rp&>&& __f); }; void f() { typedef int T; @@ -164,3 +165,51 @@ namespace test16 { } } } + +namespace test17 { + namespace { + struct I { + }; + } + template <typename T1, typename T2> void foo() {} + template <typename T, T x> void bar() {} // expected-note {{candidate function}} + inline void *g() { + struct L { + }; + // foo<L, I>'s linkage should be the merge of UniqueExternalLinkage (or + // InternalLinkage in c++11) and VisibleNoLinkage. The correct answer is + // NoLinkage in both cases. This means that using foo<L, I> as a template + // argument should fail. + return reinterpret_cast<void*>(bar<typeof(foo<L, I>), foo<L, I> >); // expected-error {{reinterpret_cast cannot resolve overloaded function 'bar' to type 'void *}} + } + void h() { + g(); + } +} + +namespace test18 { + template <typename T> struct foo { + template <T *P> static void f() {} + static void *g() { return (void *)f<&x>; } + static T x; + }; + template <typename T> T foo<T>::x; + inline void *f() { + struct S { + }; + return foo<S>::g(); + } + void *h() { return f(); } +} + +extern "C" void pr16247_foo(int); +static void pr16247_foo(double); +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) {} +} |