This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/29234] Call to operator() of temporary object wrongly parsed



------- Comment #1 from bangerth at dealii dot org  2006-10-10 03:51 -------
Confirmed:
------------------
struct S { void operator () (); };

void foo ()
{
  ( S()() );
}
------------------

g/x> /home/bangerth/bin/gcc-4.2-pre/bin/c++ -c x.cc
x.cc: In function ‘void foo()’:
x.cc:5: error: ‘type name’ declared as function returning a
function
x.cc:5: error: ‘type name’ declared as function returning a
function

The error message also isn't particularly enlightening, and is duplicated
on top of that.

I think what is happening is that we parse the expression as the beginning
of a C-style cast to type
  S (*) ()
but when we don't find an argument for the cast, we should backtrack.

W.


-- 

bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bangerth at dealii dot org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |rejects-valid
           Priority|P3                          |P2
   Last reconfirmed|0000-00-00 00:00:00         |2006-10-10 03:51:44
               date|                            |
            Summary|Cannot put temporary member |Call to operator() of
                   |functor calls inside        |temporary object wrongly
                   |brackets                    |parsed


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29234


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]