From 952eddef9aff85b1e92626e89baaf7a360e2ac85 Mon Sep 17 00:00:00 2001 From: dim Date: Sun, 22 Dec 2013 00:07:40 +0000 Subject: Vendor import of clang release_34 branch r197841 (effectively, 3.4 RC3): https://llvm.org/svn/llvm-project/cfe/branches/release_34@197841 --- test/SemaCXX/linkage2.cpp | 55 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 3 deletions(-) (limited to 'test/SemaCXX/linkage2.cpp') 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 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 void foo() {} + template void bar() {} // expected-note {{candidate function}} + inline void *g() { + struct L { + }; + // foo'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 as a template + // argument should fail. + return reinterpret_cast(bar), foo >); // expected-error {{reinterpret_cast cannot resolve overloaded function 'bar' to type 'void *}} + } + void h() { + g(); + } +} + +namespace test18 { + template struct foo { + template static void f() {} + static void *g() { return (void *)f<&x>; } + static T x; + }; + template T foo::x; + inline void *f() { + struct S { + }; + return foo::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) {} +} -- cgit v1.1