From 5eda81624ff3b9f617fa377f43d89f36741460a7 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Thu, 9 Jul 2009 17:37:12 +0000 Subject: [PATCH] Pass the DeclName to the diagnostic builder so that member names will be quoted correctly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75150 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaDeclCXX.cpp | 4 ++-- test/SemaCXX/default-constructor-initializers.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 72adcc22d1..5b22bb76fb 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -1989,13 +1989,13 @@ void Sema::DefineImplicitDefaultConstructor(SourceLocation CurrentLocation, } else if (FieldType->isReferenceType()) { Diag(CurrentLocation, diag::err_unintialized_member) - << Context.getTagDeclType(ClassDecl) << 0 << (*Field)->getNameAsCString(); + << Context.getTagDeclType(ClassDecl) << 0 << Field->getDeclName(); Diag((*Field)->getLocation(), diag::note_declared_at); err = true; } else if (FieldType.isConstQualified()) { Diag(CurrentLocation, diag::err_unintialized_member) - << Context.getTagDeclType(ClassDecl) << 1 << (*Field)->getNameAsCString(); + << Context.getTagDeclType(ClassDecl) << 1 << Field->getDeclName(); Diag((*Field)->getLocation(), diag::note_declared_at); err = true; } diff --git a/test/SemaCXX/default-constructor-initializers.cpp b/test/SemaCXX/default-constructor-initializers.cpp index 24c5383962..12149e55a7 100644 --- a/test/SemaCXX/default-constructor-initializers.cpp +++ b/test/SemaCXX/default-constructor-initializers.cpp @@ -20,7 +20,7 @@ struct X4 { }; X4 x4; // expected-error {{cannot define the implicit default constructor for 'struct X4', because base class 'struct X2' does not have any default constructor}} \ - // expected-error {{cannot define the implicit default constructor for 'struct X4', because reference member rx2 cannot be default-initialized}} + // expected-error {{cannot define the implicit default constructor for 'struct X4', because reference member 'rx2' cannot be default-initialized}} struct Y1 { // has no implicit default constructor @@ -51,6 +51,6 @@ struct Z1 { volatile int v1; }; -Z1 z1; // expected-error {{cannot define the implicit default constructor for 'struct Z1', because reference member z cannot be default-initialized}} \ - // expected-error {{cannot define the implicit default constructor for 'struct Z1', because const member c1 cannot be default-initialized}} +Z1 z1; // expected-error {{cannot define the implicit default constructor for 'struct Z1', because reference member 'z' cannot be default-initialized}} \ + // expected-error {{cannot define the implicit default constructor for 'struct Z1', because const member 'c1' cannot be default-initialized}} -- 2.40.0