From: Jakub Jelinek Date: Fri, 16 Sep 2016 20:22:35 +0000 (+0200) Subject: re PR c++/77338 (ICE on invalid C++11 code on x86_64-linux-gnu: Segmentation fault) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1c2f613fbcc6ed7da19d8ed5aa487c813c21297b;p=gcc.git 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) : Only call is_really_empty_class on complete types. * g++.dg/cpp0x/decltype-77338.C: New test. From-SVN: r240196 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ee0818e2edf..0c7d35140bf 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2016-09-16 Jakub Jelinek + PR c++/77338 + * constexpr.c (cxx_eval_constant_expression) : Only + call is_really_empty_class on complete types. + PR c++/77375 * class.c (check_bases): Set CLASSTYPE_HAS_MUTABLE if any TYPE_HAS_MUTABLE_P for any bases. diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index 34806d6749a..9308c548621 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -3744,7 +3744,8 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t, /* Defer in case this is only used for its type. */; else if (TREE_CODE (TREE_TYPE (t)) == REFERENCE_TYPE) /* 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. */ r = build_constructor (TREE_TYPE (t), NULL); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bd3f70f0d5f..30d7615ef68 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2016-09-16 Jakub Jelinek + PR c++/77338 + * g++.dg/cpp0x/decltype-77338.C: New test. + PR c++/77375 * g++.dg/cpp0x/mutable1.C: New test. diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype-77338.C b/gcc/testsuite/g++.dg/cpp0x/decltype-77338.C new file mode 100644 index 00000000000..4ba7c96d32c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype-77338.C @@ -0,0 +1,7 @@ +// PR c++/77338 +// { dg-do compile { target c++11 } } + +struct S; + +template +auto f (S s) -> decltype (s (s)); // { dg-error "no match for call to" }