summaryrefslogtreecommitdiff
path: root/test/CXX/expr/expr.prim
diff options
context:
space:
mode:
authorSerge Pavlov <sepavloff@gmail.com>2015-08-23 10:22:28 +0000
committerSerge Pavlov <sepavloff@gmail.com>2015-08-23 10:22:28 +0000
commit3193d2e21f78efbd6d38874783f91fed3b858b95 (patch)
treebd0468cef2534c13110526789438a186535b83f1 /test/CXX/expr/expr.prim
parent2b06a033d151865ca944dedf899e9b36aa630f42 (diff)
downloadclang-3193d2e21f78efbd6d38874783f91fed3b858b95.tar.gz
Instantiate function declarations in instantiated functions.
If a function declaration is found inside a template function as in: template<class T> void f() { void g(int x = T::v) except(T::w); } it must be instantiated along with the enclosing template function, including default arguments and exception specification. Together with the patch committed in r240974 this implements DR1484. Differential Revision: http://reviews.llvm.org/D11194 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245810 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX/expr/expr.prim')
-rw-r--r--test/CXX/expr/expr.prim/expr.prim.lambda/default-arguments.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/default-arguments.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/default-arguments.cpp
index 38d5d0a6cd..9b0a9ad8c2 100644
--- a/test/CXX/expr/expr.prim/expr.prim.lambda/default-arguments.cpp
+++ b/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>();