* [Bug c++/66350] typename should be forbidden in inhering constructors
[not found] <bug-66350-4@http.gcc.gnu.org/bugzilla/>
@ 2015-05-31 11:33 ` redi at gcc dot gnu.org
2015-06-02 3:35 ` msebor at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2015-05-31 11:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66350
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |accepts-invalid
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-05-31
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/66350] typename should be forbidden in inhering constructors
[not found] <bug-66350-4@http.gcc.gnu.org/bugzilla/>
2015-05-31 11:33 ` [Bug c++/66350] typename should be forbidden in inhering constructors redi at gcc dot gnu.org
@ 2015-06-02 3:35 ` msebor at gcc dot gnu.org
2015-06-02 3:46 ` vgheorgh at gmail dot com
` (4 subsequent siblings)
6 siblings, 0 replies; 7+ messages in thread
From: msebor at gcc dot gnu.org @ 2015-06-02 3:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66350
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |msebor at gcc dot gnu.org
--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/66350] typename should be forbidden in inhering constructors
[not found] <bug-66350-4@http.gcc.gnu.org/bugzilla/>
2015-05-31 11:33 ` [Bug c++/66350] typename should be forbidden in inhering constructors redi at gcc dot gnu.org
2015-06-02 3:35 ` msebor at gcc dot gnu.org
@ 2015-06-02 3:46 ` vgheorgh at gmail dot com
2015-06-02 3:56 ` msebor at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 7+ messages in thread
From: vgheorgh at gmail dot com @ 2015-06-02 3:46 UTC (permalink / raw)
To: gcc-bugs
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/66350] typename should be forbidden in inhering constructors
[not found] <bug-66350-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2015-06-02 3:46 ` vgheorgh at gmail dot com
@ 2015-06-02 3:56 ` msebor at gcc dot gnu.org
2015-06-05 4:35 ` rs2740 at gmail dot com
` (2 subsequent siblings)
6 siblings, 0 replies; 7+ messages in thread
From: msebor at gcc dot gnu.org @ 2015-06-02 3:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66350
--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
You're right. My Clang test case wasn't quite the same. Recent trunk does
fail to compile it.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/66350] typename should be forbidden in inhering constructors
[not found] <bug-66350-4@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2015-06-02 3:56 ` msebor at gcc dot gnu.org
@ 2015-06-05 4:35 ` rs2740 at gmail dot com
2015-06-05 13:18 ` redi at gcc dot gnu.org
2021-12-07 1:51 ` [Bug c++/66350] typename should be forbidden in inheriting constructors pinskia at gcc dot gnu.org
6 siblings, 0 replies; 7+ messages in thread
From: rs2740 at gmail dot com @ 2015-06-05 4:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66350
TC <rs2740 at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rs2740 at gmail dot com
--- Comment #4 from TC <rs2740 at gmail dot com> ---
(In reply to Martin Sebor from comment #1)
> 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.
The point is that since 'A<T>::A; names the constructor, it isn't a type, and
so using 'typename' shouldn't be allowed.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/66350] typename should be forbidden in inhering constructors
[not found] <bug-66350-4@http.gcc.gnu.org/bugzilla/>
` (4 preceding siblings ...)
2015-06-05 4:35 ` rs2740 at gmail dot com
@ 2015-06-05 13:18 ` redi at gcc dot gnu.org
2021-12-07 1:51 ` [Bug c++/66350] typename should be forbidden in inheriting constructors pinskia at gcc dot gnu.org
6 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2015-06-05 13:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66350
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Also, "using typename Base<T>::name;" would usually re-declare a type name in
the derived class' scope, but that's not what's happening here. It's
introducing inheriting constructors, not a type.
7.3.3 [namespace.udecl]/19 says:
If a using-declaration uses the keyword typename and specifies a dependent
name (14.6.2), the name introduced by the using-declaration is treated as a
typedef-name (7.1.3).
and we definitely don't want it to be treated as a typedef-name, so "typename"
must not be used for an inheriting constructor.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/66350] typename should be forbidden in inheriting constructors
[not found] <bug-66350-4@http.gcc.gnu.org/bugzilla/>
` (5 preceding siblings ...)
2015-06-05 13:18 ` redi at gcc dot gnu.org
@ 2021-12-07 1:51 ` pinskia at gcc dot gnu.org
6 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-07 1:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66350
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |DUPLICATE
Status|NEW |RESOLVED
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is just a dup of bug 34810.
*** This bug has been marked as a duplicate of bug 34810 ***
^ permalink raw reply [flat|nested] 7+ messages in thread