]> granicus.if.org Git - clang/commitdiff
A little more lambda capture initialization diagnostics cleanup
authorDouglas Gregor <dgregor@apple.com>
Wed, 15 Feb 2012 17:05:32 +0000 (17:05 +0000)
committerDouglas Gregor <dgregor@apple.com>
Wed, 15 Feb 2012 17:05:32 +0000 (17:05 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150589 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticSemaKinds.td
test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp

index c6923c6715ade9733c1c68e777679e36e3a15123..d9dadce1d3d9fd071887d672405cf0aff64d9f6b 100644 (file)
@@ -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<
index e99130fcd638ddfa4631f95b40066e09d0acdd36..678fa4b964d493bac317508089a70c4bfbb7e235 100644 (file)
@@ -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 {