public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/29234]  New: Cannot put temporary member functor calls inside brackets
@ 2006-09-26 10:40 lloyd dot reed at vistec-semi dot com
  2006-10-10  3:51 ` [Bug c++/29234] Call to operator() of temporary object wrongly parsed bangerth at dealii dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: lloyd dot reed at vistec-semi dot com @ 2006-09-26 10:40 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-06-26 19:24 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-29234-4@http.gcc.gnu.org/bugzilla/>
2012-09-17 17:54 ` [Bug c++/29234] Call to operator() of temporary object wrongly parsed poletti.marco at gmail dot com
2012-09-17 17:57 ` poletti.marco at gmail dot com
2012-09-17 17:59 ` poletti.marco at gmail dot com
2013-10-30 14:42 ` paolo.carlini at oracle dot com
2013-10-30 17:58 ` paolo.carlini at oracle dot com
2013-11-02  9:34 ` paolo at gcc dot gnu.org
2013-11-02  9:36 ` paolo.carlini at oracle dot com
2014-06-26 19:24 ` paolo.carlini at oracle dot com
2006-09-26 10:40 [Bug c++/29234] New: Cannot put temporary member functor calls inside brackets lloyd dot reed at vistec-semi dot com
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

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).