* [C++ PATCH] Fix ICE with PARM_DECL with incomplete type (PR c++/77338)
@ 2016-08-29 19:46 Jakub Jelinek
2016-09-16 19:49 ` Jason Merrill
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2016-08-29 19:46 UTC (permalink / raw)
To: Jason Merrill; +Cc: gcc-patches
Hi!
In r239289 you've done something similar for the VAR_DECL etc. case, but
for PARM_DECL we can still call is_really_empty_class on incomplete types
and ICE because TYPE_BINFO is NULL.
Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?
2016-08-29 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.
* g++.dg/cpp0x/decltype-77338.C: New test.
--- gcc/cp/constexpr.c.jj 2016-08-12 17:33:42.000000000 +0200
+++ gcc/cp/constexpr.c 2016-08-29 14:26:50.342319322 +0200
@@ -3747,7 +3747,8 @@ cxx_eval_constant_expression (const cons
/* 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);
--- gcc/testsuite/g++.dg/cpp0x/decltype-77338.C.jj 2016-08-29 14:42:31.974306247 +0200
+++ gcc/testsuite/g++.dg/cpp0x/decltype-77338.C 2016-08-29 14:41:12.000000000 +0200
@@ -0,0 +1,7 @@
+// 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" }
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [C++ PATCH] Fix ICE with PARM_DECL with incomplete type (PR c++/77338)
2016-08-29 19:46 [C++ PATCH] Fix ICE with PARM_DECL with incomplete type (PR c++/77338) Jakub Jelinek
@ 2016-09-16 19:49 ` Jason Merrill
0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2016-09-16 19:49 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: gcc-patches List
OK.
On Mon, Aug 29, 2016 at 3:46 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> In r239289 you've done something similar for the VAR_DECL etc. case, but
> for PARM_DECL we can still call is_really_empty_class on incomplete types
> and ICE because TYPE_BINFO is NULL.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
> trunk?
>
> 2016-08-29 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.
>
> * g++.dg/cpp0x/decltype-77338.C: New test.
>
> --- gcc/cp/constexpr.c.jj 2016-08-12 17:33:42.000000000 +0200
> +++ gcc/cp/constexpr.c 2016-08-29 14:26:50.342319322 +0200
> @@ -3747,7 +3747,8 @@ cxx_eval_constant_expression (const cons
> /* 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);
> --- gcc/testsuite/g++.dg/cpp0x/decltype-77338.C.jj 2016-08-29 14:42:31.974306247 +0200
> +++ gcc/testsuite/g++.dg/cpp0x/decltype-77338.C 2016-08-29 14:41:12.000000000 +0200
> @@ -0,0 +1,7 @@
> +// 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" }
>
> Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-09-16 19:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-29 19:46 [C++ PATCH] Fix ICE with PARM_DECL with incomplete type (PR c++/77338) Jakub Jelinek
2016-09-16 19:49 ` Jason Merrill
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).