From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20115 invoked by alias); 18 Jul 2003 22:25:18 -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 20102 invoked by uid 48); 18 Jul 2003 22:25:17 -0000 Date: Fri, 18 Jul 2003 22:25:00 -0000 From: "bangerth at dealii dot org" To: gcc-bugs@gcc.gnu.org Message-ID: <20030718222516.11582.bangerth@dealii.org> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/11582] New: Odd error message with dynamically sized template arg printing X-Bugzilla-Reason: CC X-SW-Source: 2003-07/txt/msg02202.txt.bz2 List-Id: PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11582 Summary: Odd error message with dynamically sized template arg printing Product: gcc Version: unknown Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: bangerth at dealii dot org CC: gcc-bugs at gcc dot gnu dot org,gdr at gcc dot gnu dot org Extracted from PR 6785: I guess this is totally irrelevant (because the code is invalid), but nevertheless: for this code ------------------------------------------------- template int size(); template void f(int (&)[N]); void g() { int buf[size()]; f( buf ) ; } ------------------------------------------------- we get the following error: tmp/gg> ../build-gcc/gcc-install/bin/c++ -c x.cc x.cc: In function `void g()': x.cc:6: error: no matching function for call to `f(int[size() [with T = int]()])' Note how we try to write the size of the array as an expression, which involves the call to a templated function, and where it tries to place the template arg when printing it. It is a little confusing to see the [with T=int] here, since T is nowhere referenced before or after, and the placing is odd. And then there is the duplicate () after the templates are printed. This can be seen here too: ---------------------------------- int size(); template void f(int (&)[N]); void g() { int buf[size()]; f( buf ) ; } ------------------------------------- tmp/gg> ../build-gcc/gcc-install/bin/c++ -c x.cc x.cc: In function `void g()': x.cc:6: error: no matching function for call to `f(int[size()()])' I think that looks just cute ;-) W.