[cfe-commits] r140139 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td test/SemaCXX/overload-0x.cpp

John McCall rjmccall at apple.com
Mon Sep 19 23:21:28 PDT 2011


Author: rjmccall
Date: Tue Sep 20 01:21:28 2011
New Revision: 140139

URL: http://llvm.org/viewvc/llvm-project?rev=140139&view=rev
Log:
Fix a crash-on-invalid with bad CV-qualification on 'this' in the
presence of an implicit move assignment operator.  I think the implicit
copy assignment operator case was also wrong, but just in a "displaying
the wrong diagnostic" way.


Added:
    cfe/trunk/test/SemaCXX/overload-0x.cpp
Modified:
    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=140139&r1=140138&r2=140139&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Sep 20 01:21:28 2011
@@ -1790,15 +1790,18 @@
     "function |function |constructor |"
     "constructor (the implicit default constructor)|"
     "constructor (the implicit copy constructor)|"
+    "constructor (the implicit move constructor)|"
     "function (the implicit copy assignment operator)|"
+    "function (the implicit move assignment operator)|"
     "constructor (inherited)}0%1 not viable: "
     "%select{%ordinal6|'this'}5 argument (%2) has "
     "%select{no|__unsafe_unretained|__strong|__weak|__autoreleasing}3 ownership,"
     " but parameter has %select{no|__unsafe_unretained|__strong|__weak|"
     "__autoreleasing}4 ownership">;
 def note_ovl_candidate_bad_cvr_this : Note<"candidate "
-    "%select{|function|||function||||"
-    "function (the implicit copy assignment operator)|}0 not viable: "
+    "%select{|function|||function|||||"
+    "function (the implicit copy assignment operator)|"
+    "function (the implicit move assignment operator)|}0 not viable: "
     "'this' argument has type %2, but method is not marked "
     "%select{const|restrict|const or restrict|volatile|const or volatile|"
     "volatile or restrict|const, volatile, or restrict}3">;

Added: cfe/trunk/test/SemaCXX/overload-0x.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/overload-0x.cpp?rev=140139&view=auto
==============================================================================
--- cfe/trunk/test/SemaCXX/overload-0x.cpp (added)
+++ cfe/trunk/test/SemaCXX/overload-0x.cpp Tue Sep 20 01:21:28 2011
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s 
+
+namespace test0 {
+  struct A { // expected-note {{candidate function (the implicit copy assignment operator) not viable: 'this' argument has type 'const test0::A', but method is not marked const}} expected-note {{candidate function (the implicit move assignment operator) not viable: 'this' argument has type 'const test0::A', but method is not marked const}}
+    A &operator=(void*); // expected-note {{candidate function not viable: 'this' argument has type 'const test0::A', but method is not marked const}}
+  };
+
+  void test(const A &a) {
+    a = "help"; // expected-error {{no viable overloaded '='}}
+  }
+}





More information about the cfe-commits mailing list