public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/34810] accepts invalid dependent(?) type in template class method
       [not found] <bug-34810-4@http.gcc.gnu.org/bugzilla/>
@ 2021-08-11 21:51 ` pinskia at gcc dot gnu.org
  2021-12-07  1:48 ` pinskia at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-11 21:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=34810

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2008-01-16 13:26:36         |2021-8-11

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
clang does a pedwarning:
<source>:7:22: error: ISO C++ specifies that qualified reference to 'Foo' is a
constructor name rather than a type in this context, despite preceding
'typename' keyword [-Werror,-Winjected-class-name]
    typename Foo<T>::Foo ();
                     ^

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/34810] accepts invalid dependent(?) type in template class method
       [not found] <bug-34810-4@http.gcc.gnu.org/bugzilla/>
  2021-08-11 21:51 ` [Bug c++/34810] accepts invalid dependent(?) type in template class method pinskia at gcc dot gnu.org
@ 2021-12-07  1:48 ` pinskia at gcc dot gnu.org
  2021-12-07  1:49 ` pinskia at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-07  1:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=34810

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |johelegp at gmail dot com

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 103564 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/34810] accepts invalid dependent(?) type in template class method
       [not found] <bug-34810-4@http.gcc.gnu.org/bugzilla/>
  2021-08-11 21:51 ` [Bug c++/34810] accepts invalid dependent(?) type in template class method pinskia at gcc dot gnu.org
  2021-12-07  1:48 ` pinskia at gcc dot gnu.org
@ 2021-12-07  1:49 ` pinskia at gcc dot gnu.org
  2021-12-07  1:51 ` pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-07  1:49 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=34810

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ahuszagh at gmail dot com

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 82347 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/34810] accepts invalid dependent(?) type in template class method
       [not found] <bug-34810-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2021-12-07  1:49 ` pinskia at gcc dot gnu.org
@ 2021-12-07  1:51 ` pinskia at gcc dot gnu.org
  2021-12-07  1:57 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 13+ 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=34810

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vgheorgh at gmail dot com

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 66350 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/34810] accepts invalid dependent(?) type in template class method
       [not found] <bug-34810-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2021-12-07  1:51 ` pinskia at gcc dot gnu.org
@ 2021-12-07  1:57 ` pinskia at gcc dot gnu.org
  2021-12-07  2:03 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-07  1:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=34810

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=11764

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Related to the older bug 11764 (which is fixed the case without typename I
think).

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/34810] accepts invalid dependent(?) type in template class method
       [not found] <bug-34810-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2021-12-07  1:57 ` pinskia at gcc dot gnu.org
@ 2021-12-07  2:03 ` pinskia at gcc dot gnu.org
  2021-12-07  2:04 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-07  2:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=34810

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
DR 147 is definitely the defect report here. 

Reading the new text still gives me questions about the case if typename is
used:
If the nested-name-specifier nominates a class C, and the name specified after
the nested-name-specifier, when looked up in C, is the injected-class-name of C
(clause Clause 11 [class]), the name is instead considered to name the
constructor of class C. Such a constructor name shall only be used in the
declarator-id of a constructor definition that appears outside of the class
definition.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/34810] accepts invalid dependent(?) type in template class method
       [not found] <bug-34810-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2021-12-07  2:03 ` pinskia at gcc dot gnu.org
@ 2021-12-07  2:04 ` pinskia at gcc dot gnu.org
  2021-12-07  2:22 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-07  2:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=34810

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
               Host|i386-portbld-freebsd6.2     |
              Build|i386-portbld-freebsd6.2     |
             Target|i386-portbld-freebsd6.2     |

--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note ICC and MSVC both accept this testcase (and the duplicated testcases)
while clang is rejects it.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/34810] accepts invalid dependent(?) type in template class method
       [not found] <bug-34810-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2021-12-07  2:04 ` pinskia at gcc dot gnu.org
@ 2021-12-07  2:22 ` pinskia at gcc dot gnu.org
  2021-12-07  2:55 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-07  2:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=34810

--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Oh this:
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#318

In a lookup in which the constructor is an acceptable lookup result, if the
nested-name-specifier nominates a class C and the name specified after the
nested-name-specifier, when looked up in C, is the injected class name of C
(clause Clause 11 [class]), the name is instead considered to name the
constructor of class C. [Note: For example, the constructor is not an
acceptable lookup result in an elaborated type specifier so the constructor
would not be used in place of the injected class name.]


So the question becomes is typename is enough here.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/34810] accepts invalid dependent(?) type in template class method
       [not found] <bug-34810-4@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2021-12-07  2:22 ` pinskia at gcc dot gnu.org
@ 2021-12-07  2:55 ` pinskia at gcc dot gnu.org
  2021-12-07  3:31 ` [Bug c++/34810] [DR1310] accepts invalid dependent " pinskia at gcc dot gnu.org
  2021-12-09  5:59 ` pinskia at gcc dot gnu.org
  10 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-07  2:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=34810

--- Comment #11 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Someone who has better understanding of the C++ standard should answer the
question if this is valid or not because I don't understand all of the specific
rules rules which are in play here. Especially when there has been some defect
reports in this area before even.

The question is:
    class B { };
    class A: public B {
        A::B ab;       // B is the inherited injected B
    };
typename A::A a;

vs:
class B { };
class A: public B {
  A::B ab;       // B is the inherited injected B
};
struct A::A a;

CWG 318 clearifies the struct case but I don't see why typename would be
handled here any different from struct case.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/34810] [DR1310] accepts invalid dependent type in template class method
       [not found] <bug-34810-4@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2021-12-07  2:55 ` pinskia at gcc dot gnu.org
@ 2021-12-07  3:31 ` pinskia at gcc dot gnu.org
  2021-12-09  5:59 ` pinskia at gcc dot gnu.org
  10 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-07  3:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=34810

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|accepts invalid             |[DR1310] accepts invalid
                   |dependent(?) type in        |dependent type in template
                   |template class method       |class method
             Blocks|                            |94404
              Alias|                            |cwg1310

--- Comment #12 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Found what changed clang to start rejecting it:
http://wg21.link/cwg1310

[Moved to DR at the April, 2013 meeting.]


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94404
[Bug 94404] [meta-bug] C++ core issues

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/34810] [DR1310] accepts invalid dependent type in template class method
       [not found] <bug-34810-4@http.gcc.gnu.org/bugzilla/>
                   ` (9 preceding siblings ...)
  2021-12-07  3:31 ` [Bug c++/34810] [DR1310] accepts invalid dependent " pinskia at gcc dot gnu.org
@ 2021-12-09  5:59 ` pinskia at gcc dot gnu.org
  10 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-09  5:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=34810

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |barry.revzin at gmail dot com

--- Comment #13 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 86818 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/34810] accepts invalid dependent(?) type in template class method
  2008-01-16 12:27 [Bug c++/34810] New: G++ accepts wrong code v dot haisman at sh dot cvut dot cz
  2008-01-16 13:33 ` [Bug c++/34810] accepts invalid dependent(?) type in template class method rguenth at gcc dot gnu dot org
@ 2008-01-16 15:25 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-01-16 15:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2008-01-16 14:53 -------
There is a defect report about what is a dependent name.  The DR causes some
things to be non dependent and not which were in the original standard and is
weird as it turns somestuff which really should be dependent into non
dependent.  I forgot the DR number.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34810


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/34810] accepts invalid dependent(?) type in template class method
  2008-01-16 12:27 [Bug c++/34810] New: G++ accepts wrong code v dot haisman at sh dot cvut dot cz
@ 2008-01-16 13:33 ` rguenth at gcc dot gnu dot org
  2008-01-16 15:25 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-01-16 13:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2008-01-16 13:26 -------
EDG rejects this with

t.C(6): error: class template "Foo<T>" has no member "Foo"
      typename Foo<T>::Foo ();
                       ^

G++ accepts this even if you instantiate Foo.  G++ also accepts

template <typename T>
struct Foo
{
  void bar ()
  {
    typename Foo<T>::Foox ();
  }
};

but rejects that once you instantiate Foo.

template struct Foo<int>;

It looks like EDG does not treat Foo<T>::Fox as dependent?


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |accepts-invalid
   Last reconfirmed|0000-00-00 00:00:00         |2008-01-16 13:26:36
               date|                            |
            Summary|G++ accepts wrong code      |accepts invalid dependent(?)
                   |                            |type in template class
                   |                            |method


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34810


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-12-09  5:59 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-34810-4@http.gcc.gnu.org/bugzilla/>
2021-08-11 21:51 ` [Bug c++/34810] accepts invalid dependent(?) type in template class method pinskia at gcc dot gnu.org
2021-12-07  1:48 ` pinskia at gcc dot gnu.org
2021-12-07  1:49 ` pinskia at gcc dot gnu.org
2021-12-07  1:51 ` pinskia at gcc dot gnu.org
2021-12-07  1:57 ` pinskia at gcc dot gnu.org
2021-12-07  2:03 ` pinskia at gcc dot gnu.org
2021-12-07  2:04 ` pinskia at gcc dot gnu.org
2021-12-07  2:22 ` pinskia at gcc dot gnu.org
2021-12-07  2:55 ` pinskia at gcc dot gnu.org
2021-12-07  3:31 ` [Bug c++/34810] [DR1310] accepts invalid dependent " pinskia at gcc dot gnu.org
2021-12-09  5:59 ` pinskia at gcc dot gnu.org
2008-01-16 12:27 [Bug c++/34810] New: G++ accepts wrong code v dot haisman at sh dot cvut dot cz
2008-01-16 13:33 ` [Bug c++/34810] accepts invalid dependent(?) type in template class method rguenth at gcc dot gnu dot org
2008-01-16 15:25 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).