public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] [5/6 Regression] Fix PR c++/66857
@ 2015-07-26  2:55 Patrick Palka
  2015-07-26  3:46 ` Patrick Palka
  0 siblings, 1 reply; 3+ messages in thread
From: Patrick Palka @ 2015-07-26  2:55 UTC (permalink / raw)
  To: gcc-patches; +Cc: jason, Patrick Palka

gcc/cp/ChangeLog:

	PR c++/66857
	* cvt.c (ocp_convert): Don't call scalar_constant_value when
	converting to a class type.

gcc/testsuite/ChangeLog:

	PR c++/66857
	* g++.dg/init/pr66857.C: New test.
---
 gcc/cp/cvt.c                        |  3 ++-
 gcc/testsuite/g++.dg/init/pr66857.C | 19 +++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/g++.dg/init/pr66857.C

diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index 13bc1f7..6d4bd9a 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -687,7 +687,8 @@ ocp_convert (tree type, tree expr, int convtype, int flags,
     }
 
   /* FIXME remove when moving to c_fully_fold model.  */
-  e = scalar_constant_value (e);
+  if (!CLASS_TYPE_P (type))
+    e = scalar_constant_value (e);
   if (error_operand_p (e))
     return error_mark_node;
 
diff --git a/gcc/testsuite/g++.dg/init/pr66857.C b/gcc/testsuite/g++.dg/init/pr66857.C
new file mode 100644
index 0000000..43b0927
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/pr66857.C
@@ -0,0 +1,19 @@
+// PR c++/66857
+// { dg-do run }
+
+const int i = 0;
+
+struct Test
+{
+  Test (const int &rhs)
+  {
+    if (&rhs != &i)
+      __builtin_abort ();
+  }
+};
+
+int
+main (void)
+{
+  Test test = i;
+}
-- 
2.5.0.rc2.22.g69b1679.dirty

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] [5/6 Regression] Fix PR c++/66857
  2015-07-26  2:55 [PATCH] [5/6 Regression] Fix PR c++/66857 Patrick Palka
@ 2015-07-26  3:46 ` Patrick Palka
  2015-07-26  8:55   ` Jason Merrill
  0 siblings, 1 reply; 3+ messages in thread
From: Patrick Palka @ 2015-07-26  3:46 UTC (permalink / raw)
  To: GCC Patches; +Cc: Jason Merrill, Patrick Palka

On Sat, Jul 25, 2015 at 7:12 PM, Patrick Palka <patrick@parcs.ath.cx> wrote:
> gcc/cp/ChangeLog:
>
>         PR c++/66857
>         * cvt.c (ocp_convert): Don't call scalar_constant_value when
>         converting to a class type.
>
> gcc/testsuite/ChangeLog:
>
>         PR c++/66857
>         * g++.dg/init/pr66857.C: New test.

This fix was approved here https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66857#c5

Committed to mainline.  Is it OK for the GCC 5 branch?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] [5/6 Regression] Fix PR c++/66857
  2015-07-26  3:46 ` Patrick Palka
@ 2015-07-26  8:55   ` Jason Merrill
  0 siblings, 0 replies; 3+ messages in thread
From: Jason Merrill @ 2015-07-26  8:55 UTC (permalink / raw)
  To: Patrick Palka, GCC Patches

On 07/25/2015 04:16 PM, Patrick Palka wrote:
> On Sat, Jul 25, 2015 at 7:12 PM, Patrick Palka <patrick@parcs.ath.cx> wrote:
>> gcc/cp/ChangeLog:
>>
>>          PR c++/66857
>>          * cvt.c (ocp_convert): Don't call scalar_constant_value when
>>          converting to a class type.
>>
>> gcc/testsuite/ChangeLog:
>>
>>          PR c++/66857
>>          * g++.dg/init/pr66857.C: New test.
>
> This fix was approved here https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66857#c5
>
> Committed to mainline.  Is it OK for the GCC 5 branch?

Yes, thanks.

Jason


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-07-26  3:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-26  2:55 [PATCH] [5/6 Regression] Fix PR c++/66857 Patrick Palka
2015-07-26  3:46 ` Patrick Palka
2015-07-26  8:55   ` 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).