public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/11715] New: Error with template keyword in a non-dependent type
@ 2003-07-29 20:22 reichelt at gcc dot gnu dot org
  2003-07-29 20:24 ` [Bug c++/11715] " pinskia at physics dot uc dot edu
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2003-07-29 20:22 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: Error with template keyword in a non-dependent type
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org

The following valid code (from PR 10398) is rejected
by g++ since at least gcc 2.95.x:

----------------------------------------------
struct A
{
    template <typename> struct B {};
};

template <typename T> struct C
{
    C() { A::template B<T> b; }
};

C<void> c;
----------------------------------------------

The error message is:

bug.cc: In constructor `C<T>::C()':
bug.cc:8: error: expected `;'
bug.cc: In constructor `C<T>::C() [with T = void]':
bug.cc:11:   instantiated from here
bug.cc:8: error: `B' undeclared (first use this function)
bug.cc:8: error: (Each undeclared identifier is reported only once for each 
   function it appears in.)

If one removes the "template" keyword in line 8 or adds
a typename before "A::template", the code compiles.


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

* [Bug c++/11715] Error with template keyword in a non-dependent type
  2003-07-29 20:22 [Bug c++/11715] New: Error with template keyword in a non-dependent type reichelt at gcc dot gnu dot org
@ 2003-07-29 20:24 ` pinskia at physics dot uc dot edu
  2003-07-29 20:25 ` pinskia at physics dot uc dot edu
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-07-29 20:24 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From pinskia at physics dot uc dot edu  2003-07-29 20:24 -------
Confirmed on the mainline (20030729).


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

* [Bug c++/11715] Error with template keyword in a non-dependent type
  2003-07-29 20:22 [Bug c++/11715] New: Error with template keyword in a non-dependent type reichelt at gcc dot gnu dot org
  2003-07-29 20:24 ` [Bug c++/11715] " pinskia at physics dot uc dot edu
@ 2003-07-29 20:25 ` pinskia at physics dot uc dot edu
  2003-07-29 22:46 ` ehrhardt at mathematik dot uni-ulm dot de
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-07-29 20:25 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at physics dot uc dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2003-07-29 20:25:47
               date|                            |


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

* [Bug c++/11715] Error with template keyword in a non-dependent type
  2003-07-29 20:22 [Bug c++/11715] New: Error with template keyword in a non-dependent type reichelt at gcc dot gnu dot org
  2003-07-29 20:24 ` [Bug c++/11715] " pinskia at physics dot uc dot edu
  2003-07-29 20:25 ` pinskia at physics dot uc dot edu
@ 2003-07-29 22:46 ` ehrhardt at mathematik dot uni-ulm dot de
  2003-08-18 22:39 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: ehrhardt at mathematik dot uni-ulm dot de @ 2003-07-29 22:46 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From ehrhardt at mathematik dot uni-ulm dot de  2003-07-29 22:46 -------
IMHO there's a typname keyword missing and the template disambiguator
isn't needed (but legal). The strange thing is, that the code is
accepted without the typname keyword if the template disambiguator is
removed.


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

* [Bug c++/11715] Error with template keyword in a non-dependent type
  2003-07-29 20:22 [Bug c++/11715] New: Error with template keyword in a non-dependent type reichelt at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2003-07-29 22:46 ` ehrhardt at mathematik dot uni-ulm dot de
@ 2003-08-18 22:39 ` pinskia at gcc dot gnu dot org
  2003-08-23  1:02 ` dhazeghi at yahoo dot com
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-08-18 22:39 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|rejects-valid               |accepts-invalid


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-08-18 22:39 -------
Changing the keyword based on Christian's anlysis.
And giving the code that was talked about which is invalid:
struct A
{
    template <typename> struct B {};
};

template <typename T> struct C
{
    C() { A::B<T> b; }
};

C<void> c;


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

* [Bug c++/11715] Error with template keyword in a non-dependent type
  2003-07-29 20:22 [Bug c++/11715] New: Error with template keyword in a non-dependent type reichelt at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2003-08-18 22:39 ` pinskia at gcc dot gnu dot org
@ 2003-08-23  1:02 ` dhazeghi at yahoo dot com
  2003-10-01  7:04 ` mmitchel at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dhazeghi at yahoo dot com @ 2003-08-23  1:02 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


dhazeghi at yahoo dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.4                         |---


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

* [Bug c++/11715] Error with template keyword in a non-dependent type
  2003-07-29 20:22 [Bug c++/11715] New: Error with template keyword in a non-dependent type reichelt at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2003-08-23  1:02 ` dhazeghi at yahoo dot com
@ 2003-10-01  7:04 ` mmitchel at gcc dot gnu dot org
  2003-10-01  9:41 ` reichelt at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2003-10-01  7:04 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From mmitchel at gcc dot gnu dot org  2003-10-01 07:04 -------
First, the code in Comment #3 is valid.  A is non-dependent!

The original code is valid.  The "template" keyword can only be used in this way
inside of a template, but if used after a non-dependent name it has no effect --
except that the thing named must be a template.  I do not have time to look up
chapter & verse right now, unfortunately.


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

* [Bug c++/11715] Error with template keyword in a non-dependent type
  2003-07-29 20:22 [Bug c++/11715] New: Error with template keyword in a non-dependent type reichelt at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2003-10-01  7:04 ` mmitchel at gcc dot gnu dot org
@ 2003-10-01  9:41 ` reichelt at gcc dot gnu dot org
  2004-01-02 11:03 ` lerdsuwa at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2003-10-01  9:41 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


reichelt at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|accepts-invalid             |rejects-valid


------- Additional Comments From reichelt at gcc dot gnu dot org  2003-10-01 09:40 -------
To sum it up:
We have a rejects-valid bug with the original code snippet.
(I'm restoring the keywords accordingly.)


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

* [Bug c++/11715] Error with template keyword in a non-dependent type
  2003-07-29 20:22 [Bug c++/11715] New: Error with template keyword in a non-dependent type reichelt at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2003-10-01  9:41 ` reichelt at gcc dot gnu dot org
@ 2004-01-02 11:03 ` lerdsuwa at gcc dot gnu dot org
  2004-03-19 10:18 ` reichelt at gcc dot gnu dot org
  2004-03-19 10:19 ` reichelt at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2004-01-02 11:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From lerdsuwa at gcc dot gnu dot org  2004-01-02 11:03 -------
Will investigate.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |lerdsuwa at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED


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


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

* [Bug c++/11715] Error with template keyword in a non-dependent type
  2003-07-29 20:22 [Bug c++/11715] New: Error with template keyword in a non-dependent type reichelt at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2004-01-02 11:03 ` lerdsuwa at gcc dot gnu dot org
@ 2004-03-19 10:18 ` reichelt at gcc dot gnu dot org
  2004-03-19 10:19 ` reichelt at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2004-03-19 10:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2004-03-19 10:18 -------
Fixed - probably by Mark's patch

http://gcc.gnu.org/ml/gcc-cvs/2004-03/msg00865.html


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |3.4.0


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


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

* [Bug c++/11715] Error with template keyword in a non-dependent type
  2003-07-29 20:22 [Bug c++/11715] New: Error with template keyword in a non-dependent type reichelt at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2004-03-19 10:18 ` reichelt at gcc dot gnu dot org
@ 2004-03-19 10:19 ` reichelt at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2004-03-19 10:19 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2004-03-19 10:19 -------
Really resolve as fixed. :-)

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2004-03-19 10:19 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-29 20:22 [Bug c++/11715] New: Error with template keyword in a non-dependent type reichelt at gcc dot gnu dot org
2003-07-29 20:24 ` [Bug c++/11715] " pinskia at physics dot uc dot edu
2003-07-29 20:25 ` pinskia at physics dot uc dot edu
2003-07-29 22:46 ` ehrhardt at mathematik dot uni-ulm dot de
2003-08-18 22:39 ` pinskia at gcc dot gnu dot org
2003-08-23  1:02 ` dhazeghi at yahoo dot com
2003-10-01  7:04 ` mmitchel at gcc dot gnu dot org
2003-10-01  9:41 ` reichelt at gcc dot gnu dot org
2004-01-02 11:03 ` lerdsuwa at gcc dot gnu dot org
2004-03-19 10:18 ` reichelt at gcc dot gnu dot org
2004-03-19 10:19 ` reichelt 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).