On Wed, Jul 3, 2013 at 12:59 PM, Kim Gräsman <[email protected]> wrote: > David, all, > > I have a test for a clang-based tool that ran clean before this > commit, and I now get an unexpected diagnostic due to an intentional > double declaration in the test; > > class Foo { > class NoUsage; // Unnecessary -- defined inline later in the class. > class NoUsageDefinedOutOfLine; // Necessary -- part of the public API. > class NoUsageDefinedOutOfLine; // Unnecessary -- second fwd declare. > ... > }; > > Our tool removes duplicate declarations, so we're interested in being > able to process code like this. Now I'm greeted with: > tests\fwd_decl_nested_class.cc:19:9: warning: class member cannot be > redeclared [-Wgnu] > class NoUsageDefinedOutOfLine; // Unnecessary -- second fwd declare. > > And this seems to be in the spirit of the fix. But: > > 1) Is -Wgnu really the right warning group for this? I'm not up to > speed on what -Wgnu means, is it to warn that this is a GNU extension?
Yes, that's what -Wgnu means. > 2) Should this warning be active for -std=c++98 or only -std=c++11? I > get the diagnostic in both modes. It should be active in both modes. This code has never been valid. > 3) Other compilers (GCC, MSVC) seem to accept it, so I think I want to > keep our current behavior until this is considered illegal by > everyone. Is my best bet just to disable the warning to let Clang Sema > accept this? Sure. If you want to disable just this one warning but keep the rest of -Wgnu enabled, please provide a patch adding a separate warning flag for this one warning (as a member of the -Wgnu group). > On Tue, Jun 11, 2013 at 5:51 AM, David Majnemer > <[email protected]> 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. > _______________________________________________ > 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
