public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "roman at binarylife dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/45113]  New: absent or confusing diagnostics of invalid template argument list in implicit template class instantiation
Date: Wed, 28 Jul 2010 19:07:00 -0000	[thread overview]
Message-ID: <bug-45113-17259@http.gcc.gnu.org/bugzilla/> (raw)

$cat test1.cpp
template<typename X,typename Y> struct is_same { static bool const value=false;
};
template<typename X> struct is_same<X,X> { static bool const value=true; };
template<typename... X> struct U {};
struct Q { typedef U<int x,int y> C; };
typedef char check[is_same<int,Q::C>::value ? 1 : -1];

$g++ -std=gnu++0x -c test1.cpp && echo $?
0

In 14.3.1, the Standard says: "A template-argument for a template-parameter
which is a type shall be a type-id." The test must fail compilation, and Q::C
can not be int.

$cat test2.cpp
template<typename... X> struct U {};
typedef U<int x,int y> B;

$g++ -std=gnu++0x -c test2.cpp 
test2.cpp:2:25: error: invalid type in declaration before ';' token

This message is confusing.

$cat test3.cpp 
template<typename X,typename Y> struct U {};
typedef U<int x,int y> A;

$g++ -c test3.cpp 
test3.cpp:2:22: error: wrong number of template arguments (1, should be 2)
test3.cpp:1:40: error: provided for 'template<class X, class Y> struct U'
test3.cpp:2:25: error: invalid type in declaration before ';' token

These messages are confusing.


-- 
           Summary: absent or confusing diagnostics of invalid template
                    argument list in implicit template class instantiation
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: roman at binarylife dot net
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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


                 reply	other threads:[~2010-07-28 19:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=bug-45113-17259@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).