This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/66350] typename should be forbidden in inhering constructors
- From: "vgheorgh at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 02 Jun 2015 03:45:55 +0000
- Subject: [Bug c++/66350] typename should be forbidden in inhering constructors
- Auto-submitted: auto-generated
- References: <bug-66350-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66350
--- Comment #2 from Vlad Gheorghiu <vgheorgh at gmail dot com> ---
(In reply to Martin Sebor from comment #1)
> Here's a reduced test case compiled with -Wall in C++ 98 mode:
>
> $ cat t.cpp && ~/bin/gcc-5.1.0/bin/g++ -Wall -std=c++98 -c t.cpp
> template <class T> struct A { A (T) { } };
> template <class T> struct B: A<T> {
> using typename A<T>::A;
> };
>
> B<int> b (0);
> t.cpp:3:26: warning: inheriting constructors only available with
> -std=c++11 or -std=gnu++11
> using typename A<T>::A;
> ^
> I don't think gcc is incorrect in accepting the code either in C++ 98 mode
> as an extension, or in C++ 11 mode. In the latter mode, accepting it is in
> keeping with the resolution of DR 147. Naming the constructor (Clang
> accepts the test case above in C++ 11 mode). That is, when 'A<T>::A'
> nominates class template A the name is instead taken to name the ctor of A.
I tried compiling your test with Clang but it fails with the same error,
http://melpon.org/wandbox/permlink/7sGeB2XfPOHkOFfN