http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52620
Bug #: 52620
Summary: using cannot import types in (non direct) base classes
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
Created attachment 26919
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26919
Test case
I might be missing something, sorry if this is just noise. It looks
very much like http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51971 ,
but instead of "using" from the immediate base class, it fails when
"using" from a grand-child. I checked the standard, and according to
_my_ reading it should work, yet this case is not presented as an example.
Please note that neither "using" in "bot" work. I have left both of
them, but of course one should suffice. It is interesting to note that
both are accepted (g++ does not report the "using" declarations as
errors - except for the duplication), yet it seems impossible to use
the imported name.
Thanks!
$ g++-mp-4.7 -std=c++0x -Wall foo.cc
foo.cc:18:3: error: 'type' does not name a type
foo.cc: In instantiation of 'struct bot<bool>':
foo.cc:28:13: required from here
foo.cc:17:26: error: redeclaration of 'using med<bool>::type'
foo.cc:16:14: note: previous declaration 'using top::type'
foo.cc: In function 'int main()':
foo.cc:26:19: warning: unused variable 'vm' [-Wunused-variable]
foo.cc:30:19: warning: unused variable 'vb' [-Wunused-variable]
$ g++-mp-4.7 --version
g++-mp-4.7 (GCC) 4.7.0 20120225 (experimental)
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ g++-4.2 -Wall foo.cc
foo.cc:18: error: ‘type’ does not name a type
foo.cc: In function ‘int main()’:
foo.cc:26: warning: unused variable ‘vm’
foo.cc:30: warning: unused variable ‘vb’
$ g++-4.2 --version
i686-apple-darwin10-g++-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
FWIW, clang 3.1 accepts both versions (using from top or from med<T>).
PS/ It is extremely confusing to be submit possible "duplicates"
that are not even C++ :(