public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "lloyd dot reed at vistec-semi dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/29234] New: Cannot put temporary member functor calls inside brackets Date: Tue, 26 Sep 2006 10:40:00 -0000 [thread overview] Message-ID: <bug-29234-13306@http.gcc.gnu.org/bugzilla/> (raw) Putting calls of temporary member functors in brackets causes an error, "error: `type name' declared as function returning a function". The following code: struct S { struct Member_functor { void operator () () { } }; }; int main( int argc, char* argv[] ) { S::Member_functor()(); // OK ( S::Member_functor()() ); // error: `type name' declared as function returning a function return 0; } produces this error using Cygwin gcc 3.4.4 on a WindowsXP Pro sp2 PC: J:\>g++ -o gcc_test2.exe gcc_test2.cpp -Wall -save-temps -v Reading specs from /usr/lib/gcc/i686-pc-cygwin/3.4.4/specs Configured with: /gcc/gcc-3.4.4/gcc-3.4.4-1/configure --verbose --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-languages=c,ada,c++,d,f77,java,objc --enable-nls --without-included-gettext --enable-version-specific-runtime-libs --without-x --enable-libgcj --disable-java-awt --with-system-zlib --enable-interpreter --disable-libgcj-debug --enable-threads=posix --enable-java-gc=boehm --disable-win32-registry --enable-sjlj-exceptions --enable-hash-synchronization --enable-libstdcxx-debug : (reconfigured) Thread model: posix gcc version 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125) /usr/lib/gcc/i686-pc-cygwin/3.4.4/cc1plus.exe -E -quiet -v -D__CYGWIN32__ -D__CYGWIN__ -Dunix -D__unix__ -D__unix -idirafter /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api -idirafter /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/lib/../../include/w32api gcc_test2.cpp -mtune=pentiumpro -Wall -o gcc_test2.ii ignoring nonexistent directory "/usr/local/include" ignoring nonexistent directory "/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/include" ignoring duplicate directory "/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/lib/../../include/w32api" #include "..." search starts here: #include <...> search starts here: /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++ /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/i686-pc-cygwin /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/backward /usr/lib/gcc/i686-pc-cygwin/3.4.4/include /usr/include /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api End of search list. /usr/lib/gcc/i686-pc-cygwin/3.4.4/cc1plus.exe -fpreprocessed gcc_test2.ii -quiet -dumpbase gcc_test2.cpp -mtune=pentiumpro -auxbase gcc_test2 -Wall -version -o gcc_test2.s GNU C++ version 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125) (i686-pc-cygwin) compiled by GNU C version 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125). GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 gcc_test2.cpp: In function `int main(int, char**)': gcc_test2.cpp:14: error: `type name' declared as function returning a function gcc_test2.cpp:14: error: `type name' declared as function returning a function The same applies to functors returning values. The contents of the preprocessed file is given below: # 1 "gcc_test2.cpp" # 1 "<built-in>" # 1 "<command line>" # 1 "gcc_test2.cpp" struct S { struct Member_functor { void operator () () { } }; }; int main( int argc, char* argv[] ) { S::Member_functor()(); ( S::Member_functor()() ); return 0; } -- Summary: Cannot put temporary member functor calls inside brackets Product: gcc Version: 3.4.4 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: lloyd dot reed at vistec-semi dot com GCC host triplet: i686-pc-cygwin http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29234
next reply other threads:[~2006-09-26 10:40 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2006-09-26 10:40 lloyd dot reed at vistec-semi dot com [this message] 2006-10-10 3:51 ` [Bug c++/29234] Call to operator() of temporary object wrongly parsed bangerth at dealii dot org 2007-02-07 5:14 ` lidaobing at gmail dot com 2009-11-13 21:07 ` pinskia at gcc dot gnu dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-29234-13306@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).