diff options
-rw-r--r-- | include/clang/Basic/DiagnosticSemaKinds.td | 5 | ||||
-rw-r--r-- | lib/Sema/SemaInit.h | 10 | ||||
-rw-r--r-- | test/SemaCXX/new-delete.cpp | 2 |
3 files changed, 9 insertions, 8 deletions
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index 4cfe94ec37..df0f7f7495 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -546,8 +546,9 @@ def err_destructor_name : Error< // 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< diff --git a/lib/Sema/SemaInit.h b/lib/Sema/SemaInit.h index 5c305545b0..d7d3756020 100644 --- a/lib/Sema/SemaInit.h +++ b/lib/Sema/SemaInit.h @@ -47,6 +47,11 @@ public: /// \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 @@ public: 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 diff --git a/test/SemaCXX/new-delete.cpp b/test/SemaCXX/new-delete.cpp index 0e0f630bc4..b058fc13d9 100644 --- a/test/SemaCXX/new-delete.cpp +++ b/test/SemaCXX/new-delete.cpp @@ -65,7 +65,7 @@ void bad_news(int *ip) (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'}} |