From 8746d127c04f5bbaf6c6e88cef8606ca5a6a54e9 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Thu, 13 Jul 2017 19:25:38 +0000 Subject: Vendor import of clang trunk r307894: https://llvm.org/svn/llvm-project/cfe/trunk@307894 --- test/SemaTemplate/constexpr-instantiate.cpp | 2 +- test/SemaTemplate/overload-candidates.cpp | 34 +++++++++++++++++++++++++---- 2 files changed, 31 insertions(+), 5 deletions(-) (limited to 'test/SemaTemplate') diff --git a/test/SemaTemplate/constexpr-instantiate.cpp b/test/SemaTemplate/constexpr-instantiate.cpp index dfb8a07d3b7d..31dbdb617a6a 100644 --- a/test/SemaTemplate/constexpr-instantiate.cpp +++ b/test/SemaTemplate/constexpr-instantiate.cpp @@ -191,7 +191,7 @@ namespace Unevaluated { static constexpr bool f() { return sizeof(T) < U::size; } template - static typename enable_if(), void>::type g() {} // expected-note {{disabled by 'enable_if'}} + static typename enable_if(), void>::type g() {} // expected-note {{requirement 'f()' was not satisfied}} }; struct U { static constexpr int size = 2; }; diff --git a/test/SemaTemplate/overload-candidates.cpp b/test/SemaTemplate/overload-candidates.cpp index c0abb5b17488..de998d74f9af 100644 --- a/test/SemaTemplate/overload-candidates.cpp +++ b/test/SemaTemplate/overload-candidates.cpp @@ -47,7 +47,7 @@ namespace boost { template struct enable_if {}; template struct enable_if { typedef T type; }; } -template typename boost::enable_if::type if_size_4(); // expected-note{{candidate template ignored: disabled by 'enable_if' [with T = char]}} +template typename boost::enable_if::type if_size_4(); // expected-note{{candidate template ignored: requirement 'sizeof(char) == 4' was not satisfied [with T = char]}} int k = if_size_4(); // expected-error{{no matching function}} namespace llvm { @@ -61,7 +61,7 @@ void test_if_int() { } template struct NonTemplateFunction { - typename boost::enable_if::type f(); // expected-error{{no type named 'type' in 'boost::enable_if'; 'enable_if' cannot be used to disable this declaration}} + typename boost::enable_if::type f(); // expected-error{{failed requirement 'sizeof(char) == 4'; 'enable_if' cannot be used to disable this declaration}} }; NonTemplateFunction NTFC; // expected-note{{here}} @@ -100,7 +100,7 @@ namespace PR15673 { #if __cplusplus <= 199711L // expected-warning@-2 {{default template arguments for a function template are a C++11 extension}} #endif - // expected-note@-4 {{candidate template ignored: disabled by 'enable_if' [with T = int]}} + // expected-note@+1 {{candidate template ignored: requirement 'a_trait::value' was not satisfied [with T = int]}} void foo() {} void bar() { foo(); } // expected-error {{no matching function for call to 'foo'}} @@ -128,7 +128,7 @@ namespace PR15673 { #if __cplusplus <= 199711L // expected-warning@-2 {{alias declarations are a C++11 extension}} #endif - // expected-note@-4 {{candidate template ignored: disabled by 'enable_if' [with T = int]}} + // expected-note@+7 {{candidate template ignored: requirement 'some_trait::value' was not satisfied [with T = int]}} template > @@ -137,4 +137,30 @@ namespace PR15673 { #endif void wibble() {} void wobble() { wibble(); } // expected-error {{no matching function for call to 'wibble'}} + + template + struct some_passing_trait : std::true_type {}; + +#if __cplusplus <= 199711L + // expected-warning@+4 {{default template arguments for a function template are a C++11 extension}} + // expected-warning@+4 {{default template arguments for a function template are a C++11 extension}} +#endif + template::value && some_trait::value), int>::type = 0> + void almost_rangesv3(); // expected-note{{candidate template ignored: requirement '42 == 43 || (some_passing_trait::value && some_trait::value)' was not satisfied}} + void test_almost_rangesv3() { almost_rangesv3(); } // expected-error{{no matching function for call to 'almost_rangesv3'}} + + #define CONCEPT_REQUIRES_(...) \ + int x = 42, \ + typename std::enable_if<(x == 43) || (__VA_ARGS__)>::type = 0 + +#if __cplusplus <= 199711L + // expected-warning@+4 {{default template arguments for a function template are a C++11 extension}} + // expected-warning@+3 {{default template arguments for a function template are a C++11 extension}} +#endif + template::value && some_trait::value)> + void rangesv3(); // expected-note{{candidate template ignored: requirement 'some_trait::value' was not satisfied [with T = int, x = 42]}} + void test_rangesv3() { rangesv3(); } // expected-error{{no matching function for call to 'rangesv3'}} } -- cgit v1.3