public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [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.
@ 2004-08-17  9:40 gcc-bugzilla at gcc dot gnu dot org
  2004-08-17  9:52 ` [Bug c++/17061] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2004-08-17  9:40 UTC (permalink / raw)
  To: gcc-bugs


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


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

* [Bug c++/17061] 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.
  2004-08-17  9:40 [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 gcc-bugzilla at gcc dot gnu dot org
@ 2004-08-17  9:52 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-17  9:52 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-17 09:52 -------
Dup of bug 11796 which is already fixed for 3.4.0 by the new C++ parser.

*** This bug has been marked as a duplicate of 11796 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
           Keywords|                            |rejects-valid
         Resolution|                            |DUPLICATE
            Summary|c++ syntax analyser bug. "A |c++ syntax analyser bug. "A
                   |a(int(x));" declares an     |a(int(x));" declares an
                   |object and calls a          |object and calls a
                   |constructor, but is parsed  |constructor, but is parsed
                   |as if it were "A a(int x);" |as if it were "A a(int x);"
                   |which declares a function   |which declares a function
                   |pointer.                    |pointer.
   Target Milestone|---                         |3.4.0


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


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

end of thread, other threads:[~2004-08-17  9:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-17  9:40 [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 gcc-bugzilla at gcc dot gnu dot org
2004-08-17  9:52 ` [Bug c++/17061] " 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).