From a1535f524bfa2e0e181a128bd84d368a71204827 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Tue, 18 Feb 2014 23:11:26 +0000 Subject: re PR c++/60225 ([c++11] ICE initializing constexpr array) /cp 2014-02-18 Paolo Carlini PR c++/60225 * semantics.c (ensure_literal_type_for_constexpr_object): Use strip_array_types. /testsuite 2014-02-18 Paolo Carlini PR c++/60225 * g++.dg/cpp0x/constexpr-ice10.C: New. /cp 2014-02-18 Paolo Carlini PR c++/60215 * semantics.c (cxx_eval_constant_expression, [COMPONENT_REF]): During error recovery allow_non_constant may be false. /testsuite 2014-02-18 Paolo Carlini PR c++/60215 * g++.dg/cpp0x/pr60215.C: New. From-SVN: r207858 --- gcc/cp/ChangeLog | 12 ++++++++++++ gcc/cp/semantics.c | 5 +++-- gcc/testsuite/ChangeLog | 10 ++++++++++ gcc/testsuite/g++.dg/cpp0x/constexpr-ice10.C | 8 ++++++++ gcc/testsuite/g++.dg/cpp0x/pr60215.C | 8 ++++++++ 5 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-ice10.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr60215.C (limited to 'gcc') diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e29e9dd..878ba4a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,15 @@ +2014-02-18 Paolo Carlini + + PR c++/60225 + * semantics.c (ensure_literal_type_for_constexpr_object): Use + strip_array_types. + +2014-02-18 Paolo Carlini + + PR c++/60215 + * semantics.c (cxx_eval_constant_expression, [COMPONENT_REF]): + During error recovery allow_non_constant may be false. + 2014-02-18 Adam Butcher PR c++/60190 diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 9fb4fc0..eb1c44e 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -7380,7 +7380,8 @@ ensure_literal_type_for_constexpr_object (tree decl) if (VAR_P (decl) && DECL_DECLARED_CONSTEXPR_P (decl) && !processing_template_decl) { - if (CLASS_TYPE_P (type) && !COMPLETE_TYPE_P (complete_type (type))) + tree stype = strip_array_types (type); + if (CLASS_TYPE_P (stype) && !COMPLETE_TYPE_P (complete_type (stype))) /* Don't complain here, we'll complain about incompleteness when we try to initialize the variable. */; else if (!literal_type_p (type)) @@ -9676,7 +9677,7 @@ cxx_eval_constant_expression (const constexpr_call *call, tree t, build_non_dependent_expr, because any expression that calls or takes the address of the function will have pulled a FUNCTION_DECL out of the COMPONENT_REF. */ - gcc_checking_assert (allow_non_constant); + gcc_checking_assert (allow_non_constant || errorcount); *non_constant_p = true; return t; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 855b0c2..6ca2560 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2014-02-18 Paolo Carlini + + PR c++/60225 + * g++.dg/cpp0x/constexpr-ice10.C: New. + +2014-02-18 Paolo Carlini + + PR c++/60215 + * g++.dg/cpp0x/pr60215.C: New. + 2014-02-18 Tobias Burnus PR fortran/49397 diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ice10.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ice10.C new file mode 100644 index 0000000..f6fc80c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ice10.C @@ -0,0 +1,8 @@ +// PR c++/60225 +// { dg-do compile { target c++11 } } + +struct A +{ + constexpr A() {} + static constexpr A a[2] = {}; // { dg-error "incomplete" } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/pr60215.C b/gcc/testsuite/g++.dg/cpp0x/pr60215.C new file mode 100644 index 0000000..2970017 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr60215.C @@ -0,0 +1,8 @@ +// PR c++/60215 +// { dg-do compile { target c++11 } } + +struct A +{ + void foo(); + int i : foo; // { dg-error "width" } +}; -- cgit v1.1