[PATCH] Implement DR85: Redeclaration of member class

David Majnemer david.majnemer at gmail.com
Mon Jun 10 11:41:20 PDT 2013


On Mon, Jun 10, 2013 at 9:14 AM, Jordan Rose <jordan_rose at apple.com> wrote:

> The text says "already-defined", but in the first case it's merely
> declared twice.
>

Fixed.


>
> If there's really no better justification than "because the standard says
> so", why not make this Ext or ExtWarn instead of Error? Clearly we already
> have this working.
>

I made it ExtWarn and gave it the flag -Wmember-class-redeclared.


>
> Jordan
>
>
> On Jun 9, 2013, at 23:51 , David Majnemer <david.majnemer at gmail.com>
> wrote:
>
> The attached patch implements DR85 [*] which disallows the existence of a
> declaration of a member class that isn't a forward declaration before it's
> definition.
>
> This means that the following would be disallowed:
> class A {
>   struct B; // note here
>   struct B; // error here
> };
>
> as well as:
> class C {
>   struct B {}; // note here
>   struct B; // error here
> };
>
> I'm very open to suggestions on the diagnostic, I couldn't think of a
> great one that doesn't boil down to "this is forbidden because the standard
> says so."
>
> [*] http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#85
>
> Thanks
> --
> David Majnemer
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130610/ffbed15d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dr85.diff
Type: application/octet-stream
Size: 4706 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130610/ffbed15d/attachment.obj>


More information about the cfe-commits mailing list