Commit b198484e by Jason Merrill Committed by Jason Merrill

class.c (finalize_literal_type_property): Update conditions.

	* class.c (finalize_literal_type_property): Update conditions.
	* method.c (defaulted_late_check): Set TYPE_HAS_CONSTEXPR_CTOR.

From-SVN: r175644
parent 1f291147
2011-06-29 Jason Merrill <jason@redhat.com> 2011-06-29 Jason Merrill <jason@redhat.com>
* class.c (finalize_literal_type_property): Update conditions.
* method.c (defaulted_late_check): Set TYPE_HAS_CONSTEXPR_CTOR.
* tree.c (build_vec_init_expr): Don't add TARGET_EXPR. * tree.c (build_vec_init_expr): Don't add TARGET_EXPR.
* typeck2.c (digest_init_r): Handle VEC_INIT_EXPR. * typeck2.c (digest_init_r): Handle VEC_INIT_EXPR.
* semantics.c (cxx_eval_vec_init_1): Correct type. * semantics.c (cxx_eval_vec_init_1): Correct type.
......
...@@ -4566,12 +4566,10 @@ finalize_literal_type_property (tree t) ...@@ -4566,12 +4566,10 @@ finalize_literal_type_property (tree t)
tree fn; tree fn;
if (cxx_dialect < cxx0x if (cxx_dialect < cxx0x
|| TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t) || TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t))
/* FIXME These constraints seem unnecessary; remove from standard.
|| !TYPE_HAS_TRIVIAL_COPY_CTOR (t)
|| TYPE_HAS_COMPLEX_MOVE_CTOR (t)*/ )
CLASSTYPE_LITERAL_P (t) = false; CLASSTYPE_LITERAL_P (t) = false;
else if (CLASSTYPE_LITERAL_P (t) && !TYPE_HAS_TRIVIAL_DFLT (t) else if (CLASSTYPE_LITERAL_P (t) && !TYPE_HAS_TRIVIAL_DFLT (t)
&& CLASSTYPE_NON_AGGREGATE (t)
&& !TYPE_HAS_CONSTEXPR_CTOR (t)) && !TYPE_HAS_CONSTEXPR_CTOR (t))
CLASSTYPE_LITERAL_P (t) = false; CLASSTYPE_LITERAL_P (t) = false;
......
...@@ -1571,10 +1571,14 @@ defaulted_late_check (tree fn) ...@@ -1571,10 +1571,14 @@ defaulted_late_check (tree fn)
} }
TREE_TYPE (fn) = build_exception_variant (TREE_TYPE (fn), eh_spec); TREE_TYPE (fn) = build_exception_variant (TREE_TYPE (fn), eh_spec);
if (DECL_DECLARED_CONSTEXPR_P (implicit_fn)) if (DECL_DECLARED_CONSTEXPR_P (implicit_fn))
/* Hmm...should we do this for out-of-class too? Should it be OK to {
add constexpr later like inline, rather than requiring /* Hmm...should we do this for out-of-class too? Should it be OK to
declarations to match? */ add constexpr later like inline, rather than requiring
DECL_DECLARED_CONSTEXPR_P (fn) = true; declarations to match? */
DECL_DECLARED_CONSTEXPR_P (fn) = true;
if (kind == sfk_constructor)
TYPE_HAS_CONSTEXPR_CTOR (ctx) = true;
}
} }
if (!DECL_DECLARED_CONSTEXPR_P (implicit_fn) if (!DECL_DECLARED_CONSTEXPR_P (implicit_fn)
......
2011-06-29 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/constexpr-is_literal.C: Adjust.
2011-06-29 Richard Guenther <rguenther@suse.de> 2011-06-29 Richard Guenther <rguenther@suse.de>
* gcc.dg/tree-ssa/loop-17.c: Adjust. * gcc.dg/tree-ssa/loop-17.c: Adjust.
......
...@@ -33,6 +33,7 @@ YES(NotLiteral (NotLiteral::*)(NotLiteral)); ...@@ -33,6 +33,7 @@ YES(NotLiteral (NotLiteral::*)(NotLiteral));
struct A { struct A {
A(const A&) = default; A(const A&) = default;
A(int);
}; };
NO(A); // no constexpr ctor other than copy NO(A); // no constexpr ctor other than copy
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment