[cfe-commits] r73782 - in /cfe/trunk: include/clang/AST/DeclCXX.h include/clang/Basic/DiagnosticSemaKinds.td lib/AST/DeclCXX.cpp lib/Sema/Sema.h lib/Sema/SemaDecl.cpp lib/Sema/SemaDeclCXX.cpp test/SemaCXX/default-contructor-initializers.cpp
Douglas Gregor
dgregor at apple.com
Mon Jun 22 10:19:11 PDT 2009
On Jun 20, 2009, at 1:29 PM, Fariborz Jahanian wrote:
> On Jun 19, 2009, at 6:11 PM, Douglas Gregor wrote:
>> On Jun 19, 2009, at 12:55 PM, Fariborz Jahanian wrote:
>>
>>> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=73782&r1=73781&r2=73782&view=diff
>>>
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> ====================================================================
>>> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
>>> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Jun
>>> 19 14:55:27 2009
>>> @@ -573,6 +573,14 @@
>>> def err_param_default_argument_nonfunc : Error<
>>> "default arguments can only be specified for parameters in a
>>> function "
>>> "declaration">;
>>> +def err_defining_default_ctor : Error<
>>> + "cannot define the default constructor for %0, because %1 does
>>> not "
>>> + "have any default constructor">;
>>
>> This is a nice error message. Could you add "base class" in there
>> before the %1, so the user knows we're talking about a base class
>> and not a member? Also, we should say "implicit default
>> constructor" to make it clear that it isn't the user's constructor.
>>
>> I wonder if it makes sense to have a note point at the base
>> specifier ("public X2") to show where the derivation came from. I
>> can imagine cases involving template types where it might not be
>> clear which base specifier results in this particular base class!
>
> I think I am already doing this; sample:
>
> default-constructor-initializers.cpp:14:4: error: cannot define the
> default constructor for 'struct X3', because member 'struct X2' does
> not have any implicit default constructor
> X3 x3; // expected-error {{cannot define the default constructor
> for 'struct X3', because member 'struct X2' does not have any
> implicit default constructor}}
> ^
> default-constructor-initializers.cpp:7:8: note: 'struct X2' declared
> here
> struct X2 : X1 { // expected-note {{'struct X2' declared here}} \
> ^
Okay, I see you've removed the word "implicit" in a later commit.
Thanks!
> Other stuff is taken care of at:
>
> http://llvm.org/viewvc/llvm-project?view=rev&revision=73833
Thanks!
- Doug
More information about the cfe-commits
mailing list