diff options
Diffstat (limited to 'clang/test')
3 files changed, 23 insertions, 5 deletions
diff --git a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/default-arguments.cpp b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/default-arguments.cpp index 38d5d0a6cd6..9b0a9ad8c25 100644 --- a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/default-arguments.cpp +++ b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/default-arguments.cpp @@ -26,23 +26,26 @@ struct NonPOD { }; struct NoDefaultCtor { - NoDefaultCtor(const NoDefaultCtor&); // expected-note{{candidate constructor}} + NoDefaultCtor(const NoDefaultCtor&); // expected-note{{candidate constructor}} \ + // expected-note{{candidate constructor not viable: requires 1 argument, but 0 were provided}} ~NoDefaultCtor(); }; template<typename T> void defargs_in_template_unused(T t) { - auto l1 = [](const T& value = T()) { }; + auto l1 = [](const T& value = T()) { }; // expected-error{{no matching constructor for initialization of 'NoDefaultCtor'}} l1(t); } template void defargs_in_template_unused(NonPOD); -template void defargs_in_template_unused(NoDefaultCtor); +template void defargs_in_template_unused(NoDefaultCtor); // expected-note{{in instantiation of function template specialization 'defargs_in_template_unused<NoDefaultCtor>' requested here}} template<typename T> void defargs_in_template_used() { - auto l1 = [](const T& value = T()) { }; // expected-error{{no matching constructor for initialization of 'NoDefaultCtor'}} - l1(); // expected-note{{in instantiation of default function argument expression for 'operator()<NoDefaultCtor>' required here}} + auto l1 = [](const T& value = T()) { }; // expected-error{{no matching constructor for initialization of 'NoDefaultCtor'}} \ + // expected-note{{candidate function not viable: requires single argument 'value', but no arguments were provided}} \ + // expected-note{{conversion candidate of type 'void (*)(const NoDefaultCtor &)'}} + l1(); // expected-error{{no matching function for call to object of type '(lambda at }} } template void defargs_in_template_used<NonPOD>(); diff --git a/clang/test/SemaTemplate/default-arguments.cpp b/clang/test/SemaTemplate/default-arguments.cpp index 439a3039211..0e972522d40 100644 --- a/clang/test/SemaTemplate/default-arguments.cpp +++ b/clang/test/SemaTemplate/default-arguments.cpp @@ -159,3 +159,10 @@ namespace DR1635 { int g() { X<int>::f(0); } // expected-note {{in instantiation of template class 'DR1635::X<int>' requested here}} } + +namespace NondefDecls { + template<typename T> void f1() { + int g1(int defarg = T::error); // expected-error{{type 'int' cannot be used prior to '::' because it has no members}} + } + template void f1<int>(); // expected-note{{in instantiation of function template specialization 'NondefDecls::f1<int>' requested here}} +} diff --git a/clang/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp b/clang/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp index f62ef61758a..6e8323d1ee2 100644 --- a/clang/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp +++ b/clang/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp @@ -178,3 +178,11 @@ namespace Variadic { } } + +namespace NondefDecls { + template<typename T> void f1() { + int g1(int) noexcept(T::error); // expected-error{{type 'int' cannot be used prior to '::' because it has no members}} + } + template void f1<int>(); // expected-note{{in instantiation of function template specialization 'NondefDecls::f1<int>' requested here}} +} + |

