public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: loewis@informatik.hu-berlin.de
To: gcc-gnats@gcc.gnu.org
Subject: c++/7435: g++ rejects certain integral constant expressions
Date: Mon, 29 Jul 2002 09:26:00 -0000	[thread overview]
Message-ID: <200207291623.g6TGNFtE014027@paros.informatik.hu-berlin.de> (raw)


>Number:         7435
>Category:       c++
>Synopsis:       g++ rejects certain integral constant expressions
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 29 09:26:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     loewis@informatik.hu-berlin.de (Martin v. Loewis)
>Release:        3.1
>Organization:
>Environment:
System: SunOS paros 5.9 Generic sun4u sparc SUNW,Sun-Blade-1000
Architecture: sun4

	
host: sparc-sun-solaris2.8
build: sparc-sun-solaris2.8
target: sparc-sun-solaris2.8
configured with: ../configure --host=sparc-sun-solaris2.8 --enable-shared --enable-threads --with-cpu=v8 --with-gnu-ld --with-gnu-as --enable-version-specific-runtime-libs
>Description:
g++ -pedantic rejects the translation unit

int x[true?(4,5):2];

with the error message

a.cc:1: warning: ISO C++ forbids variable-size array `x'
a.cc:1: variable-size type declared outside of any function

This is incorrect; according to 5.19, a constant-expression is
a conditional-expression. According to 5.16, the syntax allows

  logical-or-expression ? expression : assignment-expression

Since this expression does not violate any of the other constraints
for an integral constant expression, it should be accepted.
>How-To-Repeat:
   Compile the included program with 'g++ -pedantic'
>Fix:
   Work-around: simplify the expression.
>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2002-07-29 16:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-29  9:26 loewis [this message]
2002-09-13 16:39 nathan
2002-09-17 10:56 Martin Sebor
2003-01-28 16:50 bangerth

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=200207291623.g6TGNFtE014027@paros.informatik.hu-berlin.de \
    --to=loewis@informatik.hu-berlin.de \
    --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).