From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9912 invoked by alias); 16 Jul 2004 01:57:48 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 9721 invoked by uid 48); 16 Jul 2004 01:57:47 -0000 Date: Fri, 16 Jul 2004 01:57:00 -0000 From: "giovannibajo at libero dot it" To: gcc-bugs@gcc.gnu.org Message-ID: <20040716015746.16582.giovannibajo@libero.it> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/16582] New: Wrong diagnostic when using "&a[1]" as template argument X-Bugzilla-Reason: CC X-SW-Source: 2004-07/txt/msg01964.txt.bz2 List-Id: Compiling the following code: ----------------------------------------- template struct X { X(); X(const char* q) { /* ... */ } }; char p[] = "Vivisectionist"; X x2; // OK X x3; // ERROR ----------------------------------------- I get this error on mainline: nontype1.cc: At global scope: nontype1.cc:8: error: missing `>' to terminate the template argument list nontype1.cc:8: error: template argument 2 is invalid nontype1.cc:8: error: expected init-declarator before '>' token nontype1.cc:8: error: expected `,' or `;' before '>' token The message is totally bogus. The real problem is that a call to operator[] is not be allowed within a template argument. This happens with both 3.4 and mainline. Not a regression though since older versions even incorrectly accepted the code (in fact, I fixed this very issue within the new parser). -- Summary: Wrong diagnostic when using "&a[1]" as template argument Product: gcc Version: 3.5.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: giovannibajo at libero dot it CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16582