public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "gcc-bugzilla at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@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.
Date: Tue, 17 Aug 2004 09:40:00 -0000	[thread overview]
Message-ID: <20040817094023.17061.andrei.mischenko@mail.ru> (raw)


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


             reply	other threads:[~2004-08-17  9:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-17  9:40 gcc-bugzilla at gcc dot gnu dot org [this message]
2004-08-17  9:52 ` [Bug c++/17061] " 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=20040817094023.17061.andrei.mischenko@mail.ru \
    --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).