[cfe-commits] r70784 - in /cfe/trunk: lib/Sema/Sema.h lib/Sema/SemaDecl.cpp lib/Sema/SemaTemplate.cpp test/SemaCXX/struct-class-redecl.cpp test/SemaCXX/typedef-redecl.cpp test/SemaTemplate/class-template-decl.cpp

Sebastian Redl sebastian.redl at getdesigned.at
Thu May 14 10:56:50 PDT 2009


Douglas Gregor wrote:
>
> On May 3, 2009, at 12:10 PM, Sebastian Redl wrote:
>
>>
>> On Sun, 03 May 2009 17:18:57 -0000, Douglas Gregor <dgregor at apple.com>
>> wrote:
>>> Author: dgregor
>>> Date: Sun May  3 12:18:57 2009
>>> New Revision: 70784
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=70784&view=rev
>>> Log:
>>> One can use "class" and "struct" interchangeably to refer to a class
>>> in C++. Fixes <rdar://problem/6815995>.
>>>
>>
>> We might want a default-off warning that warns if the wrong tag is
>> used for
>> the redeclaration. This could help Clang users find MSVC
>> interoperability
>> issues, since MSVC warns about this by default.
>
> Implemented here:
>
>     http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20090511/017242.html
>
>
> Thanks for the suggestion!

I can't find the commit mail in my inbox or my trash, so I'm going to
reply here.


I'd write this diagnostic:

+def warn_struct_class_tag_mismatch : Warning<
+    "%select{struct|class}0 %select{|template}1 %2 was previously declared "
+    "as a %select{struct|class}3 %select{|template}1">,
+    InGroup<MismatchedTags>, DefaultIgnore;


simply as

+def warn_struct_class_tag_mismatch : Warning<
+    "%select{struct|class}0 %select{|template}1 %2 was previously declared "
+    "as a %select{class|struct}0 %select{|template}1">,
+    InGroup<MismatchedTags>, DefaultIgnore;

and forget about the fourth parameter. The two cases are guaranteed to
be symmetric.

Sebastian



More information about the cfe-commits mailing list