[cfe-commits] r75152 - in /cfe/trunk: lib/Sema/SemaDeclCXX.cpp test/SemaCXX/default-assignment-operator.cpp
Anders Carlsson
andersca at mac.com
Thu Jul 9 10:47:25 PDT 2009
Author: andersca
Date: Thu Jul 9 12:47:25 2009
New Revision: 75152
URL: http://llvm.org/viewvc/llvm-project?rev=75152&view=rev
Log:
Use getDeclName in DefineImplicitOverloadedAssign as well.
Modified:
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/test/SemaCXX/default-assignment-operator.cpp
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=75152&r1=75151&r2=75152&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu Jul 9 12:47:25 2009
@@ -2093,15 +2093,15 @@
}
else if (FieldType->isReferenceType()) {
Diag(ClassDecl->getLocation(), diag::err_uninitialized_member_for_assign)
- << Context.getTagDeclType(ClassDecl) << 0 << (*Field)->getNameAsCString();
- Diag((*Field)->getLocation(), diag::note_declared_at);
+ << Context.getTagDeclType(ClassDecl) << 0 << Field->getDeclName();
+ Diag(Field->getLocation(), diag::note_declared_at);
Diag(CurrentLocation, diag::note_first_required_here);
err = true;
}
else if (FieldType.isConstQualified()) {
Diag(ClassDecl->getLocation(), diag::err_uninitialized_member_for_assign)
- << Context.getTagDeclType(ClassDecl) << 1 << (*Field)->getNameAsCString();
- Diag((*Field)->getLocation(), diag::note_declared_at);
+ << Context.getTagDeclType(ClassDecl) << 1 << Field->getDeclName();
+ Diag(Field->getLocation(), diag::note_declared_at);
Diag(CurrentLocation, diag::note_first_required_here);
err = true;
}
Modified: cfe/trunk/test/SemaCXX/default-assignment-operator.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/default-assignment-operator.cpp?rev=75152&r1=75151&r2=75152&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/default-assignment-operator.cpp (original)
+++ cfe/trunk/test/SemaCXX/default-assignment-operator.cpp Thu Jul 9 12:47:25 2009
@@ -72,3 +72,19 @@
d1 = d2;
}
+// Test5
+
+class E1 { // expected-error{{cannot define the implicit default assignment operator for 'class E1', because non-static const member 'a' can't use default assignment operator}}
+public:
+ const int a; // expected-note{{declared at}}
+ E1() : a(0) {}
+
+};
+
+E1 e1, e2;
+
+void j()
+{
+ e1 = e2; // expected-note{{synthesized method is first required here}}
+}
+
More information about the cfe-commits
mailing list