From 5e09d4c96dc2846cc1fc75f80f5632612247354b Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Thu, 9 Jul 2009 17:47:25 +0000 Subject: [PATCH] Use getDeclName in DefineImplicitOverloadedAssign as well. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75152 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaDeclCXX.cpp | 8 ++++---- test/SemaCXX/default-assignment-operator.cpp | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 5b22bb76fb..e27b822337 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -2093,15 +2093,15 @@ void Sema::DefineImplicitOverloadedAssign(SourceLocation CurrentLocation, } 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; } diff --git a/test/SemaCXX/default-assignment-operator.cpp b/test/SemaCXX/default-assignment-operator.cpp index 090ba3c3ca..64ea49837b 100644 --- a/test/SemaCXX/default-assignment-operator.cpp +++ b/test/SemaCXX/default-assignment-operator.cpp @@ -72,3 +72,19 @@ void i() 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}} +} + -- 2.40.0