r183722 - Implement DR85: Redeclaration of member is forbidden
Eli Friedman
eli.friedman at gmail.com
Mon Jun 10 23:03:30 PDT 2013
On Mon, Jun 10, 2013 at 8:51 PM, David Majnemer <david.majnemer at gmail.com>wrote:
> Author: majnemer
> Date: Mon Jun 10 22:51:23 2013
> New Revision: 183722
>
> URL: http://llvm.org/viewvc/llvm-project?rev=183722&view=rev
> Log:
> Implement DR85: Redeclaration of member is forbidden
>
> Disallow the existence of a declaration of a member class that isn't a
> forward declaration before it's definition.
>
> Modified:
> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> cfe/trunk/lib/Sema/SemaDecl.cpp
> cfe/trunk/test/CXX/drs/dr0xx.cpp
> cfe/trunk/test/SemaCXX/access.cpp
> cfe/trunk/test/SemaTemplate/dependent-names.cpp
> cfe/trunk/test/SemaTemplate/instantiate-member-class.cpp
> cfe/trunk/www/cxx_dr_status.html
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=183722&r1=183721&r2=183722&view=diff
>
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Mon Jun 10
> 22:51:23 2013
> @@ -4241,6 +4241,8 @@ def note_enum_specialized_here : Note<
> "enum %0 was explicitly specialized here">;
>
> def err_member_redeclared : Error<"class member cannot be redeclared">;
> +def ext_member_redeclared : ExtWarn<"class member cannot be redeclared">,
> + InGroup<GNU>;
> def err_member_redeclared_in_instantiation : Error<
> "multiple overloads of %0 instantiate to the same signature %1">;
> def err_member_name_of_class : Error<"member %0 has the same name as its
> class">;
>
> Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=183722&r1=183721&r2=183722&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon Jun 10 22:51:23 2013
> @@ -9885,6 +9885,16 @@ Decl *Sema::ActOnTag(Scope *S, unsigned
> return TUK == TUK_Declaration ? PrevTagDecl : 0;
> }
>
> + // C++11 [class.mem]p1:
> + // A member shall not be declared twice in the member-speciï¬
> cation,
> + // except that a nested class or member class template can be
> declared
> + // and then later defined.
>
I'm not entirely sure how you managed to write "speciï¬ cation", but I'm
pretty sure that isn't what the standard says.
-Eli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130610/cdd08f75/attachment.html>
More information about the cfe-commits
mailing list