public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "bangerth at dealii dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/29234] Call to operator() of temporary object wrongly parsed
Date: Tue, 10 Oct 2006 03:51:00 -0000	[thread overview]
Message-ID: <20061010035144.24397.qmail@sourceware.org> (raw)
In-Reply-To: <bug-29234-13306@http.gcc.gnu.org/bugzilla/>



------- 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 &#8216;void foo()&#8217;:
x.cc:5: error: &#8216;type name&#8217; declared as function returning a
function
x.cc:5: error: &#8216;type name&#8217; 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


  reply	other threads:[~2006-10-10  3:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` bangerth at dealii dot org [this message]
2007-02-07  5:14 ` [Bug c++/29234] Call to operator() of temporary object wrongly parsed lidaobing at gmail dot com
2009-11-13 21:07 ` pinskia at gcc dot gnu dot org
     [not found] <bug-29234-4@http.gcc.gnu.org/bugzilla/>
2012-09-17 17:54 ` 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

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=20061010035144.24397.qmail@sourceware.org \
    --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: link
Be 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).