public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/14566] New: 'template' disambiguator rejected on base class
@ 2004-03-13  6:43 ron_hylton at hotmail dot com
  2004-03-13  7:16 ` [Bug c++/14566] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: ron_hylton at hotmail dot com @ 2004-03-13  6:43 UTC (permalink / raw)
  To: gcc-bugs

The 'template' disambiguator keyword on the base of B below causes the 
following error: "expected class-name before '{' token".  This code compiles in 
GCC 3.3.1.  Test case:

struct A
{
	template <class F>
	struct X
	{
	};
};

template <class F>
struct B : public A::template X<F>
{
};

gcc -v output:
Reading specs from /gcc-3.4/lib/gcc/i686-pc-cygwin/3.4.0/specs
Configured with: ../gcc/configure --prefix=/gcc-3.4 --enable-languages=c,c++,f77
--enable-libgcj --enable-threads=posix --with-system-zlib --enable-nls --withou
t-included-gettext --enable-interpreter --enable-version-specific-runtime-libs -
-enable-shared --disable-win32-registry --enable-java-gc=boehm --disable-hash-sy
nchronization --verbose
Thread model: posix
gcc version 3.4.0 20040312 (prerelease)

-- 
           Summary: 'template' disambiguator rejected on base class
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ron_hylton at hotmail dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-cygwin
  GCC host triplet: i686-pc-cygwin
GCC target triplet: i686-pc-cygwin


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


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

* [Bug c++/14566] [3.4/3.5 Regression] 'template' disambiguator rejected on base class
  2004-03-13  6:43 [Bug c++/14566] New: 'template' disambiguator rejected on base class ron_hylton at hotmail dot com
@ 2004-03-13  7:16 ` pinskia at gcc dot gnu dot org
  2004-03-14 20:26 ` bangerth at dealii dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-13  7:16 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-03-13 07:16 -------
Confirmed a regression from 3.3.1.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |rejects-valid
      Known to fail|                            |3.4.0 3.5.0
      Known to work|                            |3.3.1
   Last reconfirmed|0000-00-00 00:00:00         |2004-03-13 07:16:44
               date|                            |
            Summary|'template' disambiguator    |[3.4/3.5 Regression]
                   |rejected on base class      |'template' disambiguator
                   |                            |rejected on base class
   Target Milestone|---                         |3.4.1


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


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

* [Bug c++/14566] [3.4/3.5 Regression] 'template' disambiguator rejected on base class
  2004-03-13  6:43 [Bug c++/14566] New: 'template' disambiguator rejected on base class ron_hylton at hotmail dot com
  2004-03-13  7:16 ` [Bug c++/14566] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
@ 2004-03-14 20:26 ` bangerth at dealii dot org
  2004-03-15  2:02 ` [Bug c++/14566] 'template' disambiguator on base class gives a bad error message giovannibajo at libero dot it
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: bangerth at dealii dot org @ 2004-03-14 20:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-03-14 20:26 -------
I think I recall that the disambiguator was not allowed here. 
Giovanni, somehow I recall that you said that before, do you happen 
to know? 
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |giovannibajo at gcc dot gnu
                   |                            |dot org


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


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

* [Bug c++/14566] 'template' disambiguator on base class gives a bad error message
  2004-03-13  6:43 [Bug c++/14566] New: 'template' disambiguator rejected on base class ron_hylton at hotmail dot com
  2004-03-13  7:16 ` [Bug c++/14566] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
  2004-03-14 20:26 ` bangerth at dealii dot org
@ 2004-03-15  2:02 ` giovannibajo at libero dot it
  2004-03-15  3:12 ` gdr at integrable-solutions dot net
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: giovannibajo at libero dot it @ 2004-03-15  2:02 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-03-15 02:02 -------
Yes, 'template' is disallowed outside of template definition, and the base 
class list is never part of the class definition. The rationale is that '<' 
can't be an operator< in that context.

Anyway, I think Jason would agree to allow it if not pedantic, and a better 
error message would surely be desirable.

I'm keeping this as an enhancement, and I will look into this.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |giovannibajo at libero dot
                   |dot org                     |it
           Severity|normal                      |enhancement
             Status|NEW                         |ASSIGNED
           Keywords|rejects-valid               |diagnostic
      Known to work|3.3.1                       |
            Summary|[3.4/3.5 Regression]        |'template' disambiguator on
                   |'template' disambiguator    |base class gives a bad error
                   |rejected on base class      |message
   Target Milestone|3.4.1                       |---


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


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

* [Bug c++/14566] 'template' disambiguator on base class gives a bad error message
  2004-03-13  6:43 [Bug c++/14566] New: 'template' disambiguator rejected on base class ron_hylton at hotmail dot com
                   ` (2 preceding siblings ...)
  2004-03-15  2:02 ` [Bug c++/14566] 'template' disambiguator on base class gives a bad error message giovannibajo at libero dot it
@ 2004-03-15  3:12 ` gdr at integrable-solutions dot net
  2004-03-15 17:58 ` ron_hylton at hotmail dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: gdr at integrable-solutions dot net @ 2004-03-15  3:12 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at integrable-solutions dot net  2004-03-15 03:12 -------
Subject: Re:  'template' disambiguator on base class gives a bad error message

"giovannibajo at libero dot it" <gcc-bugzilla@gcc.gnu.org> writes:

| Yes, 'template' is disallowed outside of template definition, and the base 
| class list is never part of the class definition. The rationale is that '<' 
| can't be an operator< in that context.
| 
| Anyway, I think Jason would agree to allow it if not pedantic, and a better 
| error message would surely be desirable.

I agree with the better diagnostic part, but I do not for the "not
pedantic" part.

-- Gaby


-- 


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


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

* [Bug c++/14566] 'template' disambiguator on base class gives a bad error message
  2004-03-13  6:43 [Bug c++/14566] New: 'template' disambiguator rejected on base class ron_hylton at hotmail dot com
                   ` (3 preceding siblings ...)
  2004-03-15  3:12 ` gdr at integrable-solutions dot net
@ 2004-03-15 17:58 ` ron_hylton at hotmail dot com
  2004-03-16  1:41 ` giovannibajo at libero dot it
  2004-06-01  1:54 ` [Bug c++/14566] [3.4/3.5 Regression] " giovannibajo at libero dot it
  6 siblings, 0 replies; 8+ messages in thread
From: ron_hylton at hotmail dot com @ 2004-03-15 17:58 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From ron_hylton at hotmail dot com  2004-03-15 17:58 -------
In the following test case I receive an error message saying the use of the 
template disambiguator is required on the base of B::X.

template <class T>
struct A
{
	template <class F>
	class X
	{
	};
};


template <class T>
struct B
{
	template <class F>
	class X : public A<T>::X<F>
	{
	};
};
--:15: error: non-template `X' used as template
--:15: error: (use `A<T>::template X' to indicate that it is a template)
--:17: error: expected `{' before ';' token

Both Comeau C++ 4.3.3 and Intel Windows Compiler 8.0 accept the template 
disambiguator on base classes in all cases I have tried.

--Ron


-- 


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


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

* [Bug c++/14566] 'template' disambiguator on base class gives a bad error message
  2004-03-13  6:43 [Bug c++/14566] New: 'template' disambiguator rejected on base class ron_hylton at hotmail dot com
                   ` (4 preceding siblings ...)
  2004-03-15 17:58 ` ron_hylton at hotmail dot com
@ 2004-03-16  1:41 ` giovannibajo at libero dot it
  2004-06-01  1:54 ` [Bug c++/14566] [3.4/3.5 Regression] " giovannibajo at libero dot it
  6 siblings, 0 replies; 8+ messages in thread
From: giovannibajo at libero dot it @ 2004-03-16  1:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-03-16 01:41 -------
(In reply to comment #5)

> In the following test case I receive an error message saying the use of the 
> template disambiguator is required on the base of B::X.

This testcase is actually more interesting because it shows a real regression 
(valid code which is not accepted anymore by GCC). The diagnostic suggestion is 
wrong in this context, and the fix is obviously changing GCC to accept the code.

So, we keep both the rejects-valid and the insufficient diagnostic for this PR.

> Both Comeau C++ 4.3.3 and Intel Windows Compiler 8.0 accept the template 
> disambiguator on base classes in all cases I have tried.

For this specific case, the EDG frontend (which is behind both the compiler you 
mentioned) is not a good test because it is very very loosy wrt both 'typename' 
and 'template', for instance you can mostly omit them and the code will still 
compile.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|enhancement                 |critical
           Keywords|                            |rejects-valid
      Known to work|                            |3.3.3
   Target Milestone|---                         |3.4.1


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


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

* [Bug c++/14566] [3.4/3.5 Regression] 'template' disambiguator on base class gives a bad error message
  2004-03-13  6:43 [Bug c++/14566] New: 'template' disambiguator rejected on base class ron_hylton at hotmail dot com
                   ` (5 preceding siblings ...)
  2004-03-16  1:41 ` giovannibajo at libero dot it
@ 2004-06-01  1:54 ` giovannibajo at libero dot it
  6 siblings, 0 replies; 8+ messages in thread
From: giovannibajo at libero dot it @ 2004-06-01  1:54 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-06-01 01:53 -------
I'm closing this as a dup of PR 15503. The standard does not specify whether 
the code in comment #5 is invalid or not, as explained in PR 15503. This will 
be probably fixed in C++0x, and will be revised by then.

*** This bug has been marked as a duplicate of 15503 ***

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


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


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

end of thread, other threads:[~2004-06-01  1:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-13  6:43 [Bug c++/14566] New: 'template' disambiguator rejected on base class ron_hylton at hotmail dot com
2004-03-13  7:16 ` [Bug c++/14566] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
2004-03-14 20:26 ` bangerth at dealii dot org
2004-03-15  2:02 ` [Bug c++/14566] 'template' disambiguator on base class gives a bad error message giovannibajo at libero dot it
2004-03-15  3:12 ` gdr at integrable-solutions dot net
2004-03-15 17:58 ` ron_hylton at hotmail dot com
2004-03-16  1:41 ` giovannibajo at libero dot it
2004-06-01  1:54 ` [Bug c++/14566] [3.4/3.5 Regression] " giovannibajo at libero dot it

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).