<div dir="ltr">On Mon, Jun 10, 2013 at 3:44 PM, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">It'd be useful to keep one testcase of this within a class template.<br>
Also, please keep the diagnostic as an ExtWarn.<br></blockquote><div><br></div><div style>Done and done.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
On Mon, Jun 10, 2013 at 3:21 PM, David Majnemer<br>
<div class="HOEnZb"><div class="h5"><<a href="mailto:david.majnemer@gmail.com">david.majnemer@gmail.com</a>> wrote:<br>
> On Mon, Jun 10, 2013 at 12:56 PM, Richard Smith <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>><br>
> wrote:<br>
>><br>
>> On Mon, Jun 10, 2013 at 11:41 AM, David Majnemer<br>
>> <<a href="mailto:david.majnemer@gmail.com">david.majnemer@gmail.com</a>> wrote:<br>
>> > On Mon, Jun 10, 2013 at 9:14 AM, Jordan Rose <<a href="mailto:jordan_rose@apple.com">jordan_rose@apple.com</a>><br>
>> > wrote:<br>
>> >><br>
>> >> The text says "already-defined", but in the first case it's merely<br>
>> >> declared twice.<br>
>> ><br>
>> ><br>
>> > Fixed.<br>
>> ><br>
>> >><br>
>> >><br>
>> >> If there's really no better justification than "because the standard<br>
>> >> says<br>
>> >> so", why not make this Ext or ExtWarn instead of Error? Clearly we<br>
>> >> already<br>
>> >> have this working.<br>
>> ><br>
>> ><br>
>> > I made it ExtWarn and gave it the flag -Wmember-class-redeclared.<br>
>><br>
>> In C++11, the relevant text is: "A member shall not be declared<br>
>> twice in the member-specification, except that a nested class or<br>
>> member class template can be declared and<br>
>> then later defined, and except that an enumeration can be introduced<br>
>> with an opaque-enum-declaration and<br>
>> later redeclared with an enum-specifier."<br>
>><br>
>><br>
>> Please add tests for the union and enum cases too, and make sure the<br>
>> patch correctly handles them.<br>
>><br>
>> struct A {<br>
>>   union U;<br>
>>   union U {}; // ok<br>
>>   union U; // error<br>
>><br>
>>   enum E1 : int;<br>
>>   enum E1 : int { e1 }; // ok<br>
>>   enum E1 : int; // error<br>
>><br>
>>   enum class E2;<br>
>>   enum class E2 { e2 }; // ok<br>
>>   enum class E2; // error<br>
>> };<br>
><br>
><br>
> Done.<br>
><br>
>><br>
>><br>
>> >> Jordan<br>
>> >><br>
>> >><br>
>> >> On Jun 9, 2013, at 23:51 , David Majnemer <<a href="mailto:david.majnemer@gmail.com">david.majnemer@gmail.com</a>><br>
>> >> wrote:<br>
>> >><br>
>> >> The attached patch implements DR85 [*] which disallows the existence of<br>
>> >> a<br>
>> >> declaration of a member class that isn't a forward declaration before<br>
>> >> it's<br>
>> >> definition.<br>
>> >><br>
>> >> This means that the following would be disallowed:<br>
>> >> class A {<br>
>> >>   struct B; // note here<br>
>> >>   struct B; // error here<br>
>> >> };<br>
>> >><br>
>> >> as well as:<br>
>> >> class C {<br>
>> >>   struct B {}; // note here<br>
>> >>   struct B; // error here<br>
>> >> };<br>
>> >><br>
>> >> I'm very open to suggestions on the diagnostic, I couldn't think of a<br>
>> >> great one that doesn't boil down to "this is forbidden because the<br>
>> >> standard<br>
>> >> says so."<br>
>> >><br>
>> >> [*] <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#85" target="_blank">http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#85</a><br>
>> >><br>
>> >> Thanks<br>
>> >> --<br>
>> >> David Majnemer<br>
>> >><br>
>> >><br>
>> >> _______________________________________________<br>
>> >> cfe-commits mailing list<br>
>> >> <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
>> >> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
>> >><br>
>> >><br>
>> >><br>
>> ><br>
>> ><br>
>> > _______________________________________________<br>
>> > cfe-commits mailing list<br>
>> > <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
>> > <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
>> ><br>
><br>
><br>
</div></div></blockquote></div><br></div></div>