From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20248 invoked by alias); 11 Jul 2008 09:57:30 -0000 Received: (qmail 20116 invoked by uid 48); 11 Jul 2008 09:56:47 -0000 Date: Fri, 11 Jul 2008 09:57:00 -0000 Subject: [Bug c++/36805] New: compilation fails when pointer to template-functions are returned by ?-operator X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "rbuergel at web dot de" 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: 2008-07/txt/msg01091.txt.bz2 The following program fails to compile: template void f() {} void g1() {} void g2() {} typedef void(*ptrType)(); int main(int argc, char** argv) { ptrType p = argc == 1 ? &f : &f; //<-- error ptrType p2 = argc == 1 ? &g1 : &g2; ptrType p1; if (argc== 1) p1 = &f; else p1 = &f; } fptr.cpp:11: error: address of overloaded function with no contextual type information As f and f are the same pointer-type, this shouldn't fail. It doesn't fail for non-template-functions and it aslo doesn't fail if an if/else-clause is used. tried with gcc-4.3.1, 4.2.4 and 4.1.2 on x86_64 and 4.2.3 on powerpc-uclibc -- Summary: compilation fails when pointer to template-functions are returned by ?-operator Product: gcc Version: 4.2.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rbuergel at web dot de http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36805