From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25022 invoked by alias); 17 Aug 2004 09:40:28 -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 25015 invoked by alias); 17 Aug 2004 09:40:27 -0000 Date: Tue, 17 Aug 2004 09:40:00 -0000 From: "gcc-bugzilla at gcc dot gnu dot org" To: gcc-bugs@gcc.gnu.org Message-ID: <20040817094023.17061.andrei.mischenko@mail.ru> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/17061] New: c++ syntax analyser bug. "A a(int(x));" declares an object and calls a constructor, but is parsed as if it were "A a(int x);" which declares a function pointer. X-Bugzilla-Reason: CC X-SW-Source: 2004-08/txt/msg01642.txt.bz2 List-Id: c++ syntax analyser bug. "A a(int(x));" declares an object and calls a cast operator and constructor, but is parsed as if it were "A a(int x);" which declares a function pointer.Thus the compiler forbids the feather legal usage of an object "a". Environment: System: Linux xenon 2.6.6-perfctr-xenon #1 Wed Jun 23 19:37:00 MSD 2004 i686 GNU/Linux Architecture: i686 host: i486-pc-linux-gnu build: i486-pc-linux-gnu target: i486-pc-linux-gnu configured with: ../src/configure -v --enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-debug --enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc i486-linux How-To-Repeat: struct A { A(int x){} void m(void){} }; void f(void) { double x = 5.0; A a(int(x)); a.m(); } //bug.cpp: In function `void f()': //bug.cpp:11: error: request for member `m' in `a', which is of non-aggregate // type `A ()(int)' ------- Additional Comments From andrei dot mischenko at mail dot ru 2004-08-17 09:40 ------- Fix: //instead of A a(int(x)); //one should use one of the following A a((int)x); A a = A(int(x)); -- Summary: c++ syntax analyser bug. "A a(int(x));" declares an object and calls a constructor, but is parsed as if it were "A a(int x);" which declares a function pointer. Product: gcc Version: 3.3.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: andrei dot mischenko at mail dot ru CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i486-pc-linux-gnu GCC host triplet: i486-pc-linux-gnu GCC target triplet: i486-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17061