summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaTemplate/instantiate-local-class.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2015-12-11 01:56:36 +0000
committerJohn McCall <rjmccall@apple.com>2015-12-11 01:56:36 +0000
commitdc40b618cf397df7369406b3f61e91ccb57fb9f6 (patch)
treed544471453fefba0d5d5dfd314fcc8fc64a19acc /clang/test/SemaTemplate/instantiate-local-class.cpp
parent38f2bfbbe49dc66cf33a542d3d00b115203e29eb (diff)
downloadbcm5719-llvm-dc40b618cf397df7369406b3f61e91ccb57fb9f6.tar.gz
bcm5719-llvm-dc40b618cf397df7369406b3f61e91ccb57fb9f6.zip
Correctly type-check the default arguments of local functions
when eagerly instantiating them. rdar://23721638 llvm-svn: 255325
Diffstat (limited to 'clang/test/SemaTemplate/instantiate-local-class.cpp')
-rw-r--r--clang/test/SemaTemplate/instantiate-local-class.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/clang/test/SemaTemplate/instantiate-local-class.cpp b/clang/test/SemaTemplate/instantiate-local-class.cpp
index c0ea6a0bc87..a61af7a5af3 100644
--- a/clang/test/SemaTemplate/instantiate-local-class.cpp
+++ b/clang/test/SemaTemplate/instantiate-local-class.cpp
@@ -448,3 +448,30 @@ namespace PR21332 {
}
template void f7<int>();
}
+
+// rdar://23721638: Ensure that we correctly perform implicit
+// conversions when instantiating the default arguments of local functions.
+namespace rdar23721638 {
+ struct A {
+ A(const char *) = delete; // expected-note 2 {{explicitly marked deleted here}}
+ };
+
+ template <typename T> void foo() {
+ struct Inner { // expected-note {{in instantiation}}
+ void operator()(T a = "") {} // expected-error {{conversion function from 'const char [1]' to 'rdar23721638::A' invokes a deleted function}}
+ // expected-note@-1 {{passing argument to parameter 'a' here}}
+ // expected-note@-2 {{candidate function not viable}}
+ };
+ Inner()(); // expected-error {{no matching function}}
+ }
+ template void foo<A>(); // expected-note 2 {{in instantiation}}
+
+ template <typename T> void bar() {
+ auto lambda = [](T a = "") {}; // expected-error {{conversion function from 'const char [1]' to 'rdar23721638::A' invokes a deleted function}}
+ // expected-note@-1 {{passing argument to parameter 'a' here}}
+ // expected-note@-2 {{candidate function not viable}}
+ // expected-note@-3 {{conversion candidate of type}}
+ lambda(); // expected-error {{no matching function}}
+ }
+ template void bar<A>(); // expected-note {{in instantiation}}
+}
OpenPOWER on IntegriCloud