public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: joel.zuhars@med.ge.com
To: gcc-gnats@gcc.gnu.org
Subject: c++/8237: parse error for legal code - works on intel and solaris compilers
Date: Tue, 15 Oct 2002 15:56:00 -0000	[thread overview]
Message-ID: <20021015225155.20328.qmail@sources.redhat.com> (raw)


>Number:         8237
>Category:       c++
>Synopsis:       parse error for legal code - works on intel and solaris compilers
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Tue Oct 15 15:56:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Joel Zuhars
>Release:        gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-110)
>Organization:
>Environment:
Linux on intel machine
>Description:
Hello, the following simple code gives a parse error when compiling with g++, but works on both intel and solaris compilers. Is it a bug, or am I just missing something obvious? Thanks for any help.

> cat testVec.C
#include <stdio.h>

class A {
public:
  A() { printf("Acon\n"); }
  };

class B {
public:
  B(A a) { printf("BAcon\n"); }
  void form() { printf("Bform\n"); }
  };

int main() {
  B(A()).form();
}

brutus [joel]: /home/joel/tvec[21]
> g++ testVec.C -o TestVec
testVec.C: In function `int main ()':
testVec.C:16: parse error before `.'

brutus [joel]: /home/joel/tvec [22]         
> icc testVec.C -o TestVec

testVec.C

brutus [joel]: /home/joel/tvec [23]
> TestVec 
Acon
BAcon
Bform
     
brutus [joel]: /home/joel/tvec [24]
> g++ -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-110)

>How-To-Repeat:

>Fix:
use "A a; B(a).form();" instead of "B(A()).form();"
or add constructor A(int i) and use "B(A(1)).form();"
>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2002-10-15 22:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-15 15:56 joel.zuhars [this message]
2002-10-15 16:09 gdr
2002-10-15 16:16 Gabriel Dos Reis
2002-10-15 17:16 Phil Edwards
2003-01-01 14:09 neroden

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=20021015225155.20328.qmail@sources.redhat.com \
    --to=joel.zuhars@med.ge.com \
    --cc=gcc-gnats@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).