From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1153 invoked by alias); 28 Jul 2010 19:07:35 -0000 Received: (qmail 1125 invoked by uid 48); 28 Jul 2010 19:07:22 -0000 Date: Wed, 28 Jul 2010 19:07:00 -0000 Subject: [Bug c++/45113] New: absent or confusing diagnostics of invalid template argument list in implicit template class instantiation X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "roman at binarylife dot net" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-07/txt/msg03130.txt.bz2 $cat test1.cpp template struct is_same { static bool const value=false; }; template struct is_same { static bool const value=true; }; template struct U {}; struct Q { typedef U C; }; typedef char check[is_same::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 struct U {}; typedef U 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 struct U {}; typedef U 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 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