public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60254] New: [4.7/4.8/4.9 Regression] [c++11] ICE with non-const expression in static_assert
@ 2014-02-17 21:57 reichelt at gcc dot gnu.org
2014-02-17 21:58 ` [Bug c++/60254] " reichelt at gcc dot gnu.org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: reichelt at gcc dot gnu.org @ 2014-02-17 21:57 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60254
Bug ID: 60254
Summary: [4.7/4.8/4.9 Regression] [c++11] ICE with non-const
expression in static_assert
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Keywords: error-recovery, ice-on-invalid-code
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: reichelt at gcc dot gnu.org
The following invalid code snippet triggers an ICE since GCC 4.6.1:
====================================
template<typename T> bool foo(T)
{
int i;
static_assert(foo(i), "Error");
}
====================================
bug.cc: In function 'bool foo(T)':
bug.cc:4:3: error: non-constant condition for static assertion
static_assert(foo(i), "Error");
^
bug.cc:4:3: internal compiler error: unexpected expression 'foo' of kind
overload
0x73e01f cxx_eval_constant_expression
../../gcc/gcc/cp/semantics.c:9787
0x73c801 cxx_eval_call_expression
../../gcc/gcc/cp/semantics.c:8361
0x73df70 cxx_eval_constant_expression
../../gcc/gcc/cp/semantics.c:9484
0x741065 cxx_eval_outermost_constant_expr
../../gcc/gcc/cp/semantics.c:9807
0x749b25 cxx_constant_value
../../gcc/gcc/cp/semantics.c:9892
0x749b25 finish_static_assert(tree_node*, tree_node*, unsigned int, bool)
../../gcc/gcc/cp/semantics.c:6874
0x6b68e0 cp_parser_static_assert
../../gcc/gcc/cp/parser.c:11822
0x6acdd9 cp_parser_block_declaration
../../gcc/gcc/cp/parser.c:11082
0x6add21 cp_parser_declaration_statement
../../gcc/gcc/cp/parser.c:10733
0x6ae36b cp_parser_statement
../../gcc/gcc/cp/parser.c:9467
0x6af159 cp_parser_statement_seq_opt
../../gcc/gcc/cp/parser.c:9745
0x6af2c6 cp_parser_compound_statement
../../gcc/gcc/cp/parser.c:9699
0x6c349b cp_parser_function_body
../../gcc/gcc/cp/parser.c:18641
0x6c349b cp_parser_ctor_initializer_opt_and_function_body
../../gcc/gcc/cp/parser.c:18677
0x6c77e2 cp_parser_function_definition_after_declarator
../../gcc/gcc/cp/parser.c:22792
0x6c8681 cp_parser_function_definition_from_specifiers_and_declarator
../../gcc/gcc/cp/parser.c:22704
0x6c8681 cp_parser_init_declarator
../../gcc/gcc/cp/parser.c:16585
0x6c8a1a cp_parser_single_declaration
../../gcc/gcc/cp/parser.c:23113
0x6c8d04 cp_parser_template_declaration_after_export
../../gcc/gcc/cp/parser.c:22915
0x6d40a9 cp_parser_declaration
../../gcc/gcc/cp/parser.c:10947
Please submit a full bug report, [etc.]
A slightly different testcase crashes only on trunk:
====================================
struct A
{
template<typename T> bool foo(T)
{
static_assert(foo(0), "Error");
}
};
====================================
bug.cc: In member function 'bool A::foo(T)':
bug.cc:5:5: error: non-constant condition for static assertion
static_assert(foo(0), "Error");
^
bug.cc:5:5: internal compiler error: in cxx_eval_constant_expression, at
cp/semantics.c:9679
0x73df50 cxx_eval_constant_expression
../../gcc/gcc/cp/semantics.c:9679
0x73c801 cxx_eval_call_expression
../../gcc/gcc/cp/semantics.c:8361
0x73df70 cxx_eval_constant_expression
../../gcc/gcc/cp/semantics.c:9484
0x741065 cxx_eval_outermost_constant_expr
../../gcc/gcc/cp/semantics.c:9807
0x749b25 cxx_constant_value
../../gcc/gcc/cp/semantics.c:9892
0x749b25 finish_static_assert(tree_node*, tree_node*, unsigned int, bool)
../../gcc/gcc/cp/semantics.c:6874
0x6b68e0 cp_parser_static_assert
../../gcc/gcc/cp/parser.c:11822
0x6acdd9 cp_parser_block_declaration
../../gcc/gcc/cp/parser.c:11082
0x6add21 cp_parser_declaration_statement
../../gcc/gcc/cp/parser.c:10733
0x6ae36b cp_parser_statement
../../gcc/gcc/cp/parser.c:9467
0x6af159 cp_parser_statement_seq_opt
../../gcc/gcc/cp/parser.c:9745
0x6af2c6 cp_parser_compound_statement
../../gcc/gcc/cp/parser.c:9699
0x6c349b cp_parser_function_body
../../gcc/gcc/cp/parser.c:18641
0x6c349b cp_parser_ctor_initializer_opt_and_function_body
../../gcc/gcc/cp/parser.c:18677
0x6c77e2 cp_parser_function_definition_after_declarator
../../gcc/gcc/cp/parser.c:22792
0x6cfae0 cp_parser_late_parsing_for_member
../../gcc/gcc/cp/parser.c:23464
0x6aa05d cp_parser_class_specifier_1
../../gcc/gcc/cp/parser.c:19413
0x6aa05d cp_parser_class_specifier
../../gcc/gcc/cp/parser.c:19437
0x6aa05d cp_parser_type_specifier
../../gcc/gcc/cp/parser.c:14302
0x6c2b40 cp_parser_decl_specifier_seq
../../gcc/gcc/cp/parser.c:11547
Please submit a full bug report, [etc.]
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/60254] [4.7/4.8/4.9 Regression] [c++11] ICE with non-const expression in static_assert
2014-02-17 21:57 [Bug c++/60254] New: [4.7/4.8/4.9 Regression] [c++11] ICE with non-const expression in static_assert reichelt at gcc dot gnu.org
@ 2014-02-17 21:58 ` reichelt at gcc dot gnu.org
2014-02-18 6:48 ` jakub at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: reichelt at gcc dot gnu.org @ 2014-02-17 21:58 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60254
Volker Reichelt <reichelt at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |4.3.0, 4.4.0, 4.5.0, 4.6.0
Target Milestone|--- |4.7.4
Known to fail| |4.6.1, 4.7.0, 4.8.0, 4.9.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/60254] [4.7/4.8/4.9 Regression] [c++11] ICE with non-const expression in static_assert
2014-02-17 21:57 [Bug c++/60254] New: [4.7/4.8/4.9 Regression] [c++11] ICE with non-const expression in static_assert reichelt at gcc dot gnu.org
2014-02-17 21:58 ` [Bug c++/60254] " reichelt at gcc dot gnu.org
@ 2014-02-18 6:48 ` jakub at gcc dot gnu.org
2014-02-18 9:24 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-02-18 6:48 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60254
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-02-18
CC| |jakub at gcc dot gnu.org,
| |jason at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The ICE started with r172165
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/60254] [4.7/4.8/4.9 Regression] [c++11] ICE with non-const expression in static_assert
2014-02-17 21:57 [Bug c++/60254] New: [4.7/4.8/4.9 Regression] [c++11] ICE with non-const expression in static_assert reichelt at gcc dot gnu.org
2014-02-17 21:58 ` [Bug c++/60254] " reichelt at gcc dot gnu.org
2014-02-18 6:48 ` jakub at gcc dot gnu.org
@ 2014-02-18 9:24 ` rguenth at gcc dot gnu.org
2014-02-21 11:38 ` paolo.carlini at oracle dot com
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-02-18 9:24 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60254
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P5
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/60254] [4.7/4.8/4.9 Regression] [c++11] ICE with non-const expression in static_assert
2014-02-17 21:57 [Bug c++/60254] New: [4.7/4.8/4.9 Regression] [c++11] ICE with non-const expression in static_assert reichelt at gcc dot gnu.org
` (2 preceding siblings ...)
2014-02-18 9:24 ` rguenth at gcc dot gnu.org
@ 2014-02-21 11:38 ` paolo.carlini at oracle dot com
2014-02-22 0:07 ` paolo.carlini at oracle dot com
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-02-21 11:38 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60254
--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> ---
The second issue is a Dup of PR60215.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/60254] [4.7/4.8/4.9 Regression] [c++11] ICE with non-const expression in static_assert
2014-02-17 21:57 [Bug c++/60254] New: [4.7/4.8/4.9 Regression] [c++11] ICE with non-const expression in static_assert reichelt at gcc dot gnu.org
` (3 preceding siblings ...)
2014-02-21 11:38 ` paolo.carlini at oracle dot com
@ 2014-02-22 0:07 ` paolo.carlini at oracle dot com
2014-03-13 9:52 ` paolo at gcc dot gnu.org
2014-03-13 9:53 ` paolo.carlini at oracle dot com
6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-02-22 0:07 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60254
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |paolo.carlini at oracle dot com
--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> ---
On it.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/60254] [4.7/4.8/4.9 Regression] [c++11] ICE with non-const expression in static_assert
2014-02-17 21:57 [Bug c++/60254] New: [4.7/4.8/4.9 Regression] [c++11] ICE with non-const expression in static_assert reichelt at gcc dot gnu.org
` (4 preceding siblings ...)
2014-02-22 0:07 ` paolo.carlini at oracle dot com
@ 2014-03-13 9:52 ` paolo at gcc dot gnu.org
2014-03-13 9:53 ` paolo.carlini at oracle dot com
6 siblings, 0 replies; 8+ messages in thread
From: paolo at gcc dot gnu.org @ 2014-03-13 9:52 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60254
--- Comment #4 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Thu Mar 13 09:51:52 2014
New Revision: 208538
URL: http://gcc.gnu.org/viewcvs?rev=208538&root=gcc&view=rev
Log:
/cp
2014-03-13 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/60254
* semantics.c (finish_static_assert): Call cxx_constant_value only
if require_potential_rvalue_constant_expression returns true.
/testsuite
2014-03-13 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/60254
* g++.dg/cpp0x/static_assert10.C: New.
* g++.dg/cpp0x/static_assert11.C: Likewise.
* g++.dg/cpp0x/static_assert3.C: Adjust.
Added:
trunk/gcc/testsuite/g++.dg/cpp0x/static_assert10.C
trunk/gcc/testsuite/g++.dg/cpp0x/static_assert11.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/semantics.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/g++.dg/cpp0x/static_assert3.C
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/60254] [4.7/4.8/4.9 Regression] [c++11] ICE with non-const expression in static_assert
2014-02-17 21:57 [Bug c++/60254] New: [4.7/4.8/4.9 Regression] [c++11] ICE with non-const expression in static_assert reichelt at gcc dot gnu.org
` (5 preceding siblings ...)
2014-03-13 9:52 ` paolo at gcc dot gnu.org
@ 2014-03-13 9:53 ` paolo.carlini at oracle dot com
6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-03-13 9:53 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60254
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
Target Milestone|4.7.4 |4.9.0
--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Fixed for 4.9.0.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-03-13 9:53 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-17 21:57 [Bug c++/60254] New: [4.7/4.8/4.9 Regression] [c++11] ICE with non-const expression in static_assert reichelt at gcc dot gnu.org
2014-02-17 21:58 ` [Bug c++/60254] " reichelt at gcc dot gnu.org
2014-02-18 6:48 ` jakub at gcc dot gnu.org
2014-02-18 9:24 ` rguenth at gcc dot gnu.org
2014-02-21 11:38 ` paolo.carlini at oracle dot com
2014-02-22 0:07 ` paolo.carlini at oracle dot com
2014-03-13 9:52 ` paolo at gcc dot gnu.org
2014-03-13 9:53 ` paolo.carlini at oracle dot com
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).