Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 8806
Product:  
Component:  
Status: RESOLVED
Resolution: FIXED
Assigned To: Kriang Lerdsuwanakij <lerdsuwa@gcc.gnu.org>
Host:
Reported against  
Priority:  
Severity:  
Target Milestone:  
 
 
Target:
Reporter: catherin@ca.ibm.com
Add CC:
CC:
Remove selected CCs
Build:
URL:
Summary:
Keywords:
Known to work:
Known to fail:

Attachment Description Type Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 8806 depends on: 8442 Show dependency tree
Show dependency graph
Bug 8806 blocks:

Additional Comments:






View Bug Activity   |   Format For Printing   |   Clone This Bug


Description:   Last confirmed: 2003-07-30 04:28 Opened: 2002-12-04 06:16
// --------------------------------------------
template < template <class A> class B> class foo{};

template < class C > class bar
{
   foo<bar> x;
};

bar<int> test;
// ---------------------------------------------

This is invalid according to section 14.6.1 paragraph 2
"Within the scope of a class template specialization or partial specialization, when the
 name of the template is neither qualified nor followed by <, it is equivalent to the name of the 
 template followed by the template-arguments enclosed in <>."

So, in the specialization bar<int> the reference bar is actually bar<int> which does not
match the template template parameter in class foo...

Release:
unknown

Environment:
GNU C++ version 3.2 (powerpc-suse-linux)

How-To-Repeat:
// --------------------------------------------
template < template <class A> class B> class foo{};

template < class C > class bar
{
   foo<bar> x;
};

bar<int> test;
// ---------------------------------------------

g++ small.cpp
> > no errors

should issue an error message such as:
"small.cpp", line 5.8: 1540-0716 (S) The template argument "bar<int>" does not match the template parameter "template class B".
"small.cpp", line 8.10: 1540-0700 (I) The previous message was produced while processing "class bar<int>".

------- Comment #1 From Volker Reichelt 2002-12-04 06:31 -------
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed.
    gcc wrongly accepts this at least since gcc 2.95.x.

------- Comment #2 From Wolfgang Bangerth 2002-12-04 08:36 -------
From: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
To: gcc-bugs@gcc.gnu.org, <gcc-gnats@gcc.gnu.org>,
   Volker Reichelt <reichelt@igpm.rwth-aachen.de>, <catherin@ca.ibm.com>
Cc:  
Subject: Re: c++/8806: gcc accepts bad argument for template template parameter
Date: Wed, 4 Dec 2002 08:36:05 -0600 (CST)

 This is actually kind of a funny problem (an oversight in the standard?),
 and the only way I can think of to make this go the intended way would be
 to write
   foo< ::bar>
 or maybe
   foo<template bar>
 
 The first is accepted by newer compilers, the latter is
 not.
 
 Regards
   Wolfgang
 
 -------------------------------------------------------------------------
 Wolfgang Bangerth              email:           bangerth@ticam.utexas.edu
                                www: http://www.ticam.utexas.edu/~bangerth
 
 

------- Comment #3 From Kriang Lerdsuwanakij 2002-12-19 07:04 -------
Responsible-Changed-From-To: unassigned->lerdsuwa
Responsible-Changed-Why: I will fix this in the trunk after new parser merge.

------- Comment #4 From Kriang Lerdsuwanakij 2003-01-27 17:23 -------
From: Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
To: gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org, lerdsuwa@gcc.gnu.org,
        catherin@ca.ibm.com, gcc-prs@gcc.gnu.org
Cc:  
Subject: Re: c++/8806: [2003-01-22] gcc accepts bad argument for template
 template parameter
Date: Mon, 27 Jan 2003 17:23:10 +0700

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8806
 
 Patch submitted:
 
 	http://gcc.gnu.org/ml/gcc-patches/2003-01/msg02100.html
 


------- Comment #5 From Kriang Lerdsuwanakij 2003-05-16 22:39 -------
From: Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
To: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org,
       lerdsuwa@gcc.gnu.org, catherin@ca.ibm.com
Cc:  
Subject: Re: c++/8806: [2003-01-22] gcc accepts bad argument for template
 template parameter
Date: Fri, 16 May 2003 22:39:51 +0700

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8806
 
 A revised patch is just submitted:
 
 	http://gcc.gnu.org/ml/gcc-patches/2003-05/msg01475.html

------- Comment #6 From Kriang Lerdsuwanakij 2003-07-19 13:06 -------
New revised patch submitted:

  http://gcc.gnu.org/ml/gcc-patches/2003-07/msg01960.html

------- Comment #7 From Kriang Lerdsuwanakij 2003-08-01 15:09 -------
Fixed in GCC 3.4.

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug