re PR c++/45923 (constexpr diagnostics, more more)
authorJason Merrill <jason@redhat.com>
Wed, 29 Jun 2011 14:34:58 +0000 (10:34 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 29 Jun 2011 14:34:58 +0000 (10:34 -0400)
commitf732fa7b6cd8f125f19aa150d88d47a15e0099cc
treec78bb4975e01ac82dfc07cfc5592be17dedd13d2
parent874d29e5bebbebee89836e041a0de18d183d7303
re PR c++/45923 (constexpr diagnostics, more more)

PR c++/45923
* class.c (explain_non_literal_class): New.
(finalize_literal_type_property): Call it.
* cp-tree.h: Declare it.
* semantics.c (ensure_literal_type_for_constexpr_object): Call it.
(is_valid_constexpr_fn): Likewise.
(massage_constexpr_body): Split out from...
(register_constexpr_fundef): ...here.
(is_instantiation_of_constexpr): New.
(expand_or_defer_fn_1): Leave DECL_SAVED_TREE alone in that case.
(explain_invalid_constexpr_fn): New.
(cxx_eval_call_expression): Call it.
(potential_constant_expression_1): Likewise.  Avoid redundant errors.
* method.c (process_subob_fn): Diagnose non-constexpr.
(walk_field_subobs): Likewise.
(synthesized_method_walk): Don't shortcut if we want diagnostics.
(explain_implicit_non_constexpr): New.
(defaulted_late_check): Use it.
* call.c (build_cxx_call): Remember location.

From-SVN: r175646
12 files changed:
gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/class.c
gcc/cp/cp-tree.h
gcc/cp/method.c
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/constexpr-diag1.C
gcc/testsuite/g++.dg/cpp0x/constexpr-diag3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp0x/constexpr-ex1.C
gcc/testsuite/g++.dg/cpp0x/constexpr-friend.C
gcc/testsuite/g++.dg/cpp0x/constexpr-incomplete2.C