Commit 1c2f613f by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/77338 (ICE on invalid C++11 code on x86_64-linux-gnu: Segmentation fault)

	PR c++/77338
	* constexpr.c (cxx_eval_constant_expression) <case PARM_DECL>: Only
	call is_really_empty_class on complete types.

	* g++.dg/cpp0x/decltype-77338.C: New test.

From-SVN: r240196
parent e7d61178
2016-09-16 Jakub Jelinek <jakub@redhat.com> 2016-09-16 Jakub Jelinek <jakub@redhat.com>
PR c++/77338
* constexpr.c (cxx_eval_constant_expression) <case PARM_DECL>: Only
call is_really_empty_class on complete types.
PR c++/77375 PR c++/77375
* class.c (check_bases): Set CLASSTYPE_HAS_MUTABLE if any * class.c (check_bases): Set CLASSTYPE_HAS_MUTABLE if any
TYPE_HAS_MUTABLE_P for any bases. TYPE_HAS_MUTABLE_P for any bases.
......
...@@ -3744,7 +3744,8 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t, ...@@ -3744,7 +3744,8 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
/* Defer in case this is only used for its type. */; /* Defer in case this is only used for its type. */;
else if (TREE_CODE (TREE_TYPE (t)) == REFERENCE_TYPE) else if (TREE_CODE (TREE_TYPE (t)) == REFERENCE_TYPE)
/* Defer, there's no lvalue->rvalue conversion. */; /* Defer, there's no lvalue->rvalue conversion. */;
else if (is_really_empty_class (TREE_TYPE (t))) else if (COMPLETE_TYPE_P (TREE_TYPE (t))
&& is_really_empty_class (TREE_TYPE (t)))
{ {
/* If the class is empty, we aren't actually loading anything. */ /* If the class is empty, we aren't actually loading anything. */
r = build_constructor (TREE_TYPE (t), NULL); r = build_constructor (TREE_TYPE (t), NULL);
......
2016-09-16 Jakub Jelinek <jakub@redhat.com> 2016-09-16 Jakub Jelinek <jakub@redhat.com>
PR c++/77338
* g++.dg/cpp0x/decltype-77338.C: New test.
PR c++/77375 PR c++/77375
* g++.dg/cpp0x/mutable1.C: New test. * g++.dg/cpp0x/mutable1.C: New test.
......
// PR c++/77338
// { dg-do compile { target c++11 } }
struct S;
template <typename>
auto f (S s) -> decltype (s (s)); // { dg-error "no match for call to" }
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