public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: andrew@andypo.net
To: gcc-gnats@gcc.gnu.org
Subject: c++/9112: [gcc-3.4] new C++ parser rejects code older parsers accepted
Date: Tue, 31 Dec 2002 04:16:00 -0000	[thread overview]
Message-ID: <20021231120858.30954.qmail@sources.redhat.com> (raw)


>Number:         9112
>Category:       c++
>Synopsis:       [gcc-3.4] new C++ parser rejects code older parsers accepted
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Tue Dec 31 04:16:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Andrew Pollard
>Release:        gcc-3.4-20021230 (experimental)
>Organization:
>Environment:
gcc-3.4-20021230 (experimental)
>Description:
As confirmed on the gcc mailing list, the following code should compile

[ http://gcc.gnu.org/ml/gcc/2002-12/msg01615.html ]

a.cxx:
-------------------------
struct A {
       int a, b;
       A(int i, int j) : a(i), b(j) {}
       void foo() {};
};

int
main()
{
	int a = 2;
	A(a, a).foo();

	return (0);
}
--------------------------

% g++34 a.cxx
a.cxx: In function `int main()':
a.cxx:11: error: conflicting types for `A a'
a.cxx:10: error: previous declaration as `int a'
a.cxx:11: error: expected init-declarator
a.cxx:11: error: expected `,' or `;'

It appears to think that I want to declare a new variable 'a' with type 'A', whereas I want to construct a temporary A(2,2) and invoke foo() on it.

Previous versions of g++ work (3.0-cvs, 3.2-cvs, 3.3-cvs) and so do icc-70 and VC++6.0
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


                 reply	other threads:[~2002-12-31 12:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20021231120858.30954.qmail@sources.redhat.com \
    --to=andrew@andypo.net \
    --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).