This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/41039] Member reordering rule is overly strict
- From: "jwakely dot gcc at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Aug 2009 09:41:02 -0000
- Subject: [Bug c++/41039] Member reordering rule is overly strict
- References: <bug-41039-15588@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #4 from jwakely dot gcc at gmail dot com 2009-08-12 09:41 -------
I think maybe the second example is rejected because of 2) not 3)
2) A name N used in a class S shall refer to the same declaration in its
context and when re-evaluated in the
completed scope of S. No diagnostic is required for a violation of this rule.
'foo' is used in the class, but in the completed scope which includes the
function body of S::foo() 'foo' refers to the member function.
If you don't want to use -fpermissive you can convince gcc to compile it by
referring to the type as '::foo' because in that case the name always refers to
the global type even in the completed scope.
struct foo { };
struct bar {
::foo foo();
};
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41039