public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: catherin@ca.ibm.com
To: gcc-gnats@gcc.gnu.org
Subject: c++/8806: gcc accepts bad argument for template template parameter
Date: Wed, 04 Dec 2002 06:18:00 -0000	[thread overview]
Message-ID: <20021204141214.23057.qmail@sources.redhat.com> (raw)


>Number:         8806
>Category:       c++
>Synopsis:       gcc accepts bad argument for template template parameter
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 04 06:16:29 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Catherine Morton
>Release:        unknown-1.0
>Organization:
>Environment:
GNU C++ version 3.2 (powerpc-suse-linux)
>Description:
// --------------------------------------------
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...
>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>".
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2002-12-04 14:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-04  6:18 catherin [this message]
2002-12-04  6:31 reichelt
2002-12-04  6:46 Wolfgang Bangerth
2002-12-19  7:04 lerdsuwa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021204141214.23057.qmail@sources.redhat.com \
    --to=catherin@ca.ibm.com \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).