summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-02-15 17:05:32 +0000
committerDouglas Gregor <dgregor@apple.com>2012-02-15 17:05:32 +0000
commit02267a8e4888054b51d2e993b5b6d71ddd88961e (patch)
tree156935e847ee60e72ed2eaad0899d41cc2c4bc97
parent19666fb1aa7dd4428ec9eef4d880acf1c658cc37 (diff)
downloadbcm5719-llvm-02267a8e4888054b51d2e993b5b6d71ddd88961e.tar.gz
bcm5719-llvm-02267a8e4888054b51d2e993b5b6d71ddd88961e.zip
A little more lambda capture initialization diagnostics cleanup
llvm-svn: 150589
-rw-r--r--clang/include/clang/Basic/DiagnosticSemaKinds.td8
-rw-r--r--clang/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp9
2 files changed, 12 insertions, 5 deletions
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index c6923c6715a..d9dadce1d3d 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -1141,24 +1141,24 @@ def err_temp_copy_no_viable : Error<
"no viable constructor %select{copying variable|copying parameter|"
"returning object|throwing object|copying member subobject|copying array "
"element|allocating object|copying temporary|initializing base subobject|"
- "initializing vector element}0 of type %1">;
+ "initializing vector element|capturing value}0 of type %1">;
def ext_rvalue_to_reference_temp_copy_no_viable : ExtWarn<
"no viable constructor %select{copying variable|copying parameter|"
"returning object|throwing object|copying member subobject|copying array "
"element|allocating object|copying temporary|initializing base subobject|"
- "initializing vector element}0 of type %1; C++98 requires a copy "
+ "initializing vector element|capturing value}0 of type %1; C++98 requires a copy "
"constructor when binding a reference to a temporary">,
InGroup<BindToTemporaryCopy>;
def err_temp_copy_ambiguous : Error<
"ambiguous constructor call when %select{copying variable|copying "
"parameter|returning object|throwing object|copying member subobject|copying "
"array element|allocating object|copying temporary|initializing base subobject|"
- "initializing vector element}0 of type %1">;
+ "initializing vector element|capturing value}0 of type %1">;
def err_temp_copy_deleted : Error<
"%select{copying variable|copying parameter|returning object|throwing "
"object|copying member subobject|copying array element|allocating object|"
"copying temporary|initializing base subobject|initializing vector element}0 "
- "of type %1 invokes deleted constructor">;
+ "of type %1 invokes deleted constructor|capturing value">;
def err_temp_copy_incomplete : Error<
"copying a temporary object of incomplete type %0">;
def warn_cxx98_compat_temp_copy : Warning<
diff --git a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp
index e99130fcd63..678fa4b964d 100644
--- a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp
+++ b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp
@@ -8,11 +8,18 @@ public:
void foo() const;
};
-void capture_by_copy(NonCopyable nc, NonCopyable &ncr) {
+class NonConstCopy {
+public:
+ NonConstCopy(NonConstCopy&); // expected-note{{would lose const}}
+};
+
+void capture_by_copy(NonCopyable nc, NonCopyable &ncr, const NonConstCopy nco) {
(void)[nc] { }; // expected-error{{capture of variable 'nc' as type 'NonCopyable' calls private copy constructor}}
(void)[=] {
ncr.foo(); // expected-error{{capture of variable 'ncr' as type 'NonCopyable' calls private copy constructor}}
}();
+
+ [nco] {}(); // expected-error{{no matching constructor for initialization of 'const NonConstCopy'}}
}
struct NonTrivial {
OpenPOWER on IntegriCloud