public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/36089] New: [4.2/4.3/4.4 Regression] Funny rejects valid with constant integral expression
@ 2008-04-30 16:42 pinskia at gcc dot gnu dot org
2008-04-30 16:42 ` [Bug c++/36089] [4.1/4.2/4.3/4.4 " pinskia at gcc dot gnu dot org
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-04-30 16:42 UTC (permalink / raw)
To: gcc-bugs
Testcase:
template <int>
struct a
{
static bool f()
{
const int as(2);
float anArray[as] = { 0.0f, 0.0f };
return (anArray[0] == anArray[1]);
}
};
----
If we remove the const from the declaration of as, we get an error with
-pedantic-errors that we have a VLA (otherwise we accept the code).
--
Summary: [4.2/4.3/4.4 Regression] Funny rejects valid with
constant integral expression
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pinskia at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36089
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/36089] [4.1/4.2/4.3/4.4 Regression] Funny rejects valid with constant integral expression
2008-04-30 16:42 [Bug c++/36089] New: [4.2/4.3/4.4 Regression] Funny rejects valid with constant integral expression pinskia at gcc dot gnu dot org
@ 2008-04-30 16:42 ` pinskia at gcc dot gnu dot org
2008-04-30 16:55 ` pinskia at gcc dot gnu dot org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-04-30 16:42 UTC (permalink / raw)
To: gcc-bugs
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[4.2/4.3/4.4 Regression] |[4.1/4.2/4.3/4.4 Regression]
|Funny rejects valid with |Funny rejects valid with
|constant integral expression|constant integral expression
Target Milestone|--- |4.1.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36089
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/36089] [4.1/4.2/4.3/4.4 Regression] Funny rejects valid with constant integral expression
2008-04-30 16:42 [Bug c++/36089] New: [4.2/4.3/4.4 Regression] Funny rejects valid with constant integral expression pinskia at gcc dot gnu dot org
2008-04-30 16:42 ` [Bug c++/36089] [4.1/4.2/4.3/4.4 " pinskia at gcc dot gnu dot org
@ 2008-04-30 16:55 ` pinskia at gcc dot gnu dot org
2008-05-07 23:18 ` pinskia at gcc dot gnu dot org
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-04-30 16:55 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2008-04-30 16:54 -------
Also if you change as to be initialized with an equals instead of the C++ style
initialization, it works.
That is change:
const int as(2);
To:
const int as = 2;
Thanks,
Andrew Pinski
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36089
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/36089] [4.1/4.2/4.3/4.4 Regression] Funny rejects valid with constant integral expression
2008-04-30 16:42 [Bug c++/36089] New: [4.2/4.3/4.4 Regression] Funny rejects valid with constant integral expression pinskia at gcc dot gnu dot org
2008-04-30 16:42 ` [Bug c++/36089] [4.1/4.2/4.3/4.4 " pinskia at gcc dot gnu dot org
2008-04-30 16:55 ` pinskia at gcc dot gnu dot org
@ 2008-05-07 23:18 ` pinskia at gcc dot gnu dot org
2008-05-16 19:37 ` rguenth at gcc dot gnu dot org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-05-07 23:18 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2008-05-07 23:18 -------
This patch works for me:
Index: cp/parser.c
======================================================
=============
--- cp/parser.c (revision 2473)
+++ cp/parser.c (working copy)
@@ -4659,6 +4659,10 @@ cp_parser_parenthesized_expression_list
if (identifier)
expression_list = tree_cons (NULL_TREE, identifier, expression_list);
+ /* If we have a constant, just return the value. */
+ if (non_constant_p && !*non_constant_p)
+ return TREE_VALUE (expression_list);
+
return expression_list;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36089
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/36089] [4.1/4.2/4.3/4.4 Regression] Funny rejects valid with constant integral expression
2008-04-30 16:42 [Bug c++/36089] New: [4.2/4.3/4.4 Regression] Funny rejects valid with constant integral expression pinskia at gcc dot gnu dot org
` (2 preceding siblings ...)
2008-05-07 23:18 ` pinskia at gcc dot gnu dot org
@ 2008-05-16 19:37 ` rguenth at gcc dot gnu dot org
2008-05-16 20:01 ` pinskia at gcc dot gnu dot org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-05-16 19:37 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from rguenth at gcc dot gnu dot org 2008-05-16 19:36 -------
Confirmed.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Priority|P3 |P2
Last reconfirmed|0000-00-00 00:00:00 |2008-05-16 19:36:23
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36089
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/36089] [4.1/4.2/4.3/4.4 Regression] Funny rejects valid with constant integral expression
2008-04-30 16:42 [Bug c++/36089] New: [4.2/4.3/4.4 Regression] Funny rejects valid with constant integral expression pinskia at gcc dot gnu dot org
` (3 preceding siblings ...)
2008-05-16 19:37 ` rguenth at gcc dot gnu dot org
@ 2008-05-16 20:01 ` pinskia at gcc dot gnu dot org
2008-07-04 22:42 ` [Bug c++/36089] [4.2/4.3/4.4 " jsm28 at gcc dot gnu dot org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-05-16 20:01 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from pinskia at gcc dot gnu dot org 2008-05-16 20:00 -------
(In reply to comment #2)
> This patch works for me:
Note we also need to check expression_list does not have a TREE_CHAIN.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36089
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/36089] [4.2/4.3/4.4 Regression] Funny rejects valid with constant integral expression
2008-04-30 16:42 [Bug c++/36089] New: [4.2/4.3/4.4 Regression] Funny rejects valid with constant integral expression pinskia at gcc dot gnu dot org
` (4 preceding siblings ...)
2008-05-16 20:01 ` pinskia at gcc dot gnu dot org
@ 2008-07-04 22:42 ` jsm28 at gcc dot gnu dot org
2008-11-10 21:21 ` jakub at gcc dot gnu dot org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-07-04 22:42 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from jsm28 at gcc dot gnu dot org 2008-07-04 22:41 -------
Closing 4.1 branch.
--
jsm28 at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[4.1/4.2/4.3/4.4 Regression]|[4.2/4.3/4.4 Regression]
|Funny rejects valid with |Funny rejects valid with
|constant integral expression|constant integral expression
Target Milestone|4.1.3 |4.2.5
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36089
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/36089] [4.2/4.3/4.4 Regression] Funny rejects valid with constant integral expression
2008-04-30 16:42 [Bug c++/36089] New: [4.2/4.3/4.4 Regression] Funny rejects valid with constant integral expression pinskia at gcc dot gnu dot org
` (5 preceding siblings ...)
2008-07-04 22:42 ` [Bug c++/36089] [4.2/4.3/4.4 " jsm28 at gcc dot gnu dot org
@ 2008-11-10 21:21 ` jakub at gcc dot gnu dot org
2008-11-17 7:58 ` jakub at gcc dot gnu dot org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-11-10 21:21 UTC (permalink / raw)
To: gcc-bugs
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |jakub at gcc dot gnu dot org
|dot org |
URL| |http://gcc.gnu.org/ml/gcc-
| |patches/2008-
| |11/msg00383.html
Status|NEW |ASSIGNED
Last reconfirmed|2008-05-16 19:36:23 |2008-11-10 21:20:03
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36089
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/36089] [4.2/4.3/4.4 Regression] Funny rejects valid with constant integral expression
2008-04-30 16:42 [Bug c++/36089] New: [4.2/4.3/4.4 Regression] Funny rejects valid with constant integral expression pinskia at gcc dot gnu dot org
` (6 preceding siblings ...)
2008-11-10 21:21 ` jakub at gcc dot gnu dot org
@ 2008-11-17 7:58 ` jakub at gcc dot gnu dot org
2009-03-31 20:50 ` [Bug c++/36089] [4.3 " jsm28 at gcc dot gnu dot org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-11-17 7:58 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from jakub at gcc dot gnu dot org 2008-11-17 07:57 -------
Subject: Bug 36089
Author: jakub
Date: Mon Nov 17 07:55:52 2008
New Revision: 141941
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141941
Log:
PR c++/36089
* init.c (constant_value_1): Handle TREE_LIST init.
* g++.dg/template/init8.C: New test.
Added:
trunk/gcc/testsuite/g++.dg/template/init8.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/init.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36089
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/36089] [4.3 Regression] Funny rejects valid with constant integral expression
2008-04-30 16:42 [Bug c++/36089] New: [4.2/4.3/4.4 Regression] Funny rejects valid with constant integral expression pinskia at gcc dot gnu dot org
` (7 preceding siblings ...)
2008-11-17 7:58 ` jakub at gcc dot gnu dot org
@ 2009-03-31 20:50 ` jsm28 at gcc dot gnu dot org
2009-07-10 15:55 ` rguenth at gcc dot gnu dot org
2009-07-10 16:03 ` rguenth at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-03-31 20:50 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from jsm28 at gcc dot gnu dot org 2009-03-31 20:50 -------
Closing 4.2 branch.
--
jsm28 at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[4.2/4.3 Regression] Funny |[4.3 Regression] Funny
|rejects valid with constant |rejects valid with constant
|integral expression |integral expression
Target Milestone|4.2.5 |4.3.4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36089
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/36089] [4.3 Regression] Funny rejects valid with constant integral expression
2008-04-30 16:42 [Bug c++/36089] New: [4.2/4.3/4.4 Regression] Funny rejects valid with constant integral expression pinskia at gcc dot gnu dot org
` (8 preceding siblings ...)
2009-03-31 20:50 ` [Bug c++/36089] [4.3 " jsm28 at gcc dot gnu dot org
@ 2009-07-10 15:55 ` rguenth at gcc dot gnu dot org
2009-07-10 16:03 ` rguenth at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-07-10 15:55 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from rguenth at gcc dot gnu dot org 2009-07-10 15:55 -------
Subject: Bug 36089
Author: rguenth
Date: Fri Jul 10 15:55:04 2009
New Revision: 149484
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=149484
Log:
2009-07-10 Richard Guenther <rguenther@suse.de>
Backport from mainline
2008-11-17 Jakub Jelinek <jakub@redhat.com>
PR c++/36089
* init.c (constant_value_1): Handle TREE_LIST init.
PR c++/37561
PR c++/36089
* g++.dg/template/init8.C: New test.
Added:
branches/gcc-4_3-branch/gcc/testsuite/g++.dg/template/init8.C
Modified:
branches/gcc-4_3-branch/gcc/cp/ChangeLog
branches/gcc-4_3-branch/gcc/cp/init.c
branches/gcc-4_3-branch/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36089
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/36089] [4.3 Regression] Funny rejects valid with constant integral expression
2008-04-30 16:42 [Bug c++/36089] New: [4.2/4.3/4.4 Regression] Funny rejects valid with constant integral expression pinskia at gcc dot gnu dot org
` (9 preceding siblings ...)
2009-07-10 15:55 ` rguenth at gcc dot gnu dot org
@ 2009-07-10 16:03 ` rguenth at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-07-10 16:03 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from rguenth at gcc dot gnu dot org 2009-07-10 16:03 -------
Fixed.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Known to fail|4.1.2 4.3.2 |4.1.2 4.3.2 4.3.3
Known to work|4.0.1 4.4.0 |4.0.1 4.3.4 4.4.0
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36089
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2009-07-10 16:03 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-30 16:42 [Bug c++/36089] New: [4.2/4.3/4.4 Regression] Funny rejects valid with constant integral expression pinskia at gcc dot gnu dot org
2008-04-30 16:42 ` [Bug c++/36089] [4.1/4.2/4.3/4.4 " pinskia at gcc dot gnu dot org
2008-04-30 16:55 ` pinskia at gcc dot gnu dot org
2008-05-07 23:18 ` pinskia at gcc dot gnu dot org
2008-05-16 19:37 ` rguenth at gcc dot gnu dot org
2008-05-16 20:01 ` pinskia at gcc dot gnu dot org
2008-07-04 22:42 ` [Bug c++/36089] [4.2/4.3/4.4 " jsm28 at gcc dot gnu dot org
2008-11-10 21:21 ` jakub at gcc dot gnu dot org
2008-11-17 7:58 ` jakub at gcc dot gnu dot org
2009-03-31 20:50 ` [Bug c++/36089] [4.3 " jsm28 at gcc dot gnu dot org
2009-07-10 15:55 ` rguenth at gcc dot gnu dot org
2009-07-10 16:03 ` rguenth 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).