[cfe-commits] r94289 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaInit.h test/SemaCXX/new-delete.cpp
Anders Carlsson
andersca at mac.com
Fri Jan 22 21:47:27 PST 2010
Author: andersca
Date: Fri Jan 22 23:47:27 2010
New Revision: 94289
URL: http://llvm.org/viewvc/llvm-project?rev=94289&view=rev
Log:
Fix the EntityKind order so that all entity kinds that can be copied (using copy constructors) come first. Also, fix a bug where EK_New was left out of the err_init_conversion_failed diagnostic (It is now reported as 'new value'). Please review Doug :)
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaInit.h
cfe/trunk/test/SemaCXX/new-delete.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=94289&r1=94288&r2=94289&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Jan 22 23:47:27 2010
@@ -546,8 +546,9 @@
// C++ initialization
def err_init_conversion_failed : Error<
"cannot initialize %select{a variable|a parameter|return object|an "
- "exception object|a value|a base class|a member subobject|an array element}0"
- " of type %1 with an %select{rvalue|lvalue}2 of type %3">;
+ "exception object|a member subobject|an array element|a new value|a value|a "
+ "base class|an array element}0 of type %1 with an %select{rvalue|lvalue}2 of "
+ "type %3">;
def err_lvalue_to_rvalue_ref : Error<"rvalue reference cannot bind to lvalue">;
def err_invalid_initialization : Error<
Modified: cfe/trunk/lib/Sema/SemaInit.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.h?rev=94289&r1=94288&r2=94289&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.h (original)
+++ cfe/trunk/lib/Sema/SemaInit.h Fri Jan 22 23:47:27 2010
@@ -47,6 +47,11 @@
/// \brief The entity being initialized is an exception object that
/// is being thrown.
EK_Exception,
+ /// \brief The entity being initialized is a non-static data member
+ /// subobject.
+ EK_Member,
+ /// \brief The entity being initialized is an element of an array.
+ EK_ArrayElement,
/// \brief The entity being initialized is an object (or array of
/// objects) allocated via new.
EK_New,
@@ -54,11 +59,6 @@
EK_Temporary,
/// \brief The entity being initialized is a base member subobject.
EK_Base,
- /// \brief The entity being initialized is a non-static data member
- /// subobject.
- EK_Member,
- /// \brief The entity being initialized is an element of an array.
- EK_ArrayElement,
/// \brief The entity being initialized is an element of a vector.
/// or vector.
EK_VectorElement
Modified: cfe/trunk/test/SemaCXX/new-delete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/new-delete.cpp?rev=94289&r1=94288&r2=94289&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/new-delete.cpp (original)
+++ cfe/trunk/test/SemaCXX/new-delete.cpp Fri Jan 22 23:47:27 2010
@@ -65,7 +65,7 @@
(void)new S(1); // expected-error {{no matching constructor}}
(void)new S(1, 1); // expected-error {{call to constructor of 'struct S' is ambiguous}}
(void)new const int; // expected-error {{default initialization of an object of const type 'int const'}}
- (void)new float*(ip); // expected-error {{cannot initialize a value of type 'float *' with an lvalue of type 'int *'}}
+ (void)new float*(ip); // expected-error {{cannot initialize a new value of type 'float *' with an lvalue of type 'int *'}}
// Undefined, but clang should reject it directly.
(void)new int[-1]; // expected-error {{array size is negative}}
(void)new int[*(S*)0]; // expected-error {{array size expression must have integral or enumerated type, not 'struct S'}}
More information about the cfe-commits
mailing list