On Mon, Jun 10, 2013 at 3:44 PM, Richard Smith <[email protected]>wrote:
> It'd be useful to keep one testcase of this within a class template. > Also, please keep the diagnostic as an ExtWarn. > Done and done. > > On Mon, Jun 10, 2013 at 3:21 PM, David Majnemer > <[email protected]> wrote: > > On Mon, Jun 10, 2013 at 12:56 PM, Richard Smith <[email protected]> > > wrote: > >> > >> On Mon, Jun 10, 2013 at 11:41 AM, David Majnemer > >> <[email protected]> wrote: > >> > On Mon, Jun 10, 2013 at 9:14 AM, Jordan Rose <[email protected]> > >> > 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. > >> > >> In C++11, the relevant text is: "A member shall not be declared > >> twice in the member-specification, except that a nested class or > >> member class template can be declared and > >> then later defined, and except that an enumeration can be introduced > >> with an opaque-enum-declaration and > >> later redeclared with an enum-specifier." > >> > >> > >> Please add tests for the union and enum cases too, and make sure the > >> patch correctly handles them. > >> > >> struct A { > >> union U; > >> union U {}; // ok > >> union U; // error > >> > >> enum E1 : int; > >> enum E1 : int { e1 }; // ok > >> enum E1 : int; // error > >> > >> enum class E2; > >> enum class E2 { e2 }; // ok > >> enum class E2; // error > >> }; > > > > > > Done. > > > >> > >> > >> >> Jordan > >> >> > >> >> > >> >> On Jun 9, 2013, at 23:51 , David Majnemer <[email protected]> > >> >> 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 > >> >> [email protected] > >> >> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits > >> >> > >> >> > >> >> > >> > > >> > > >> > _______________________________________________ > >> > cfe-commits mailing list > >> > [email protected] > >> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits > >> > > > > > >
dr85.diff
Description: Binary data
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
