re PR c++/84942 (internal compiler error: in fold_convert_const_int_from_real, at...
authorJakub Jelinek <jakub@redhat.com>
Fri, 23 Mar 2018 20:54:01 +0000 (21:54 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 23 Mar 2018 20:54:01 +0000 (21:54 +0100)
PR c++/84942
* pt.c (tsubst_copy_and_build) <case FIX_TRUNC_EXPR>: Replace
cp_build_unary_op call with gcc_unreachable ().

* g++.dg/cpp1y/pr84942.C: New test.

From-SVN: r258821

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp1y/pr84942.C [new file with mode: 0644]

index ddda091b5fda6cef0f681b3f816e143d43f14a98..619161bf323583a70c9cfb4d8f7ac8a5733120b3 100644 (file)
@@ -1,3 +1,9 @@
+2018-03-23  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/84942
+       * pt.c (tsubst_copy_and_build) <case FIX_TRUNC_EXPR>: Replace
+       cp_build_unary_op call with gcc_unreachable ().
+
 2018-03-23  Marek Polacek  <polacek@redhat.com>
 
        PR c++/85045
index 5293c2b5491bc823601bbdbe17a25cf9ec013835..ef531b6d795c96f7c3fcd60db642d0287d7170f0 100644 (file)
@@ -17514,8 +17514,7 @@ tsubst_copy_and_build (tree t,
                                complain|decltype_flag));
 
     case FIX_TRUNC_EXPR:
-      RETURN (cp_build_unary_op (FIX_TRUNC_EXPR, RECUR (TREE_OPERAND (t, 0)),
-                                false, complain));
+      gcc_unreachable ();    
 
     case ADDR_EXPR:
       op1 = TREE_OPERAND (t, 0);
index 503ddaa6053b57333057b32ef2b1878666a8eaab..419bd560dc5a0968bbd617adbc6a6eaa50e1f124 100644 (file)
@@ -1,3 +1,8 @@
+2018-03-23  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/84942
+       * g++.dg/cpp1y/pr84942.C: New test.
+
 2018-03-23  Vladimir Makarov  <vmakarov@redhat.com>
 
        PR inline-asm/85030
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr84942.C b/gcc/testsuite/g++.dg/cpp1y/pr84942.C
new file mode 100644 (file)
index 0000000..6e2a8ac
--- /dev/null
@@ -0,0 +1,6 @@
+// PR c++/84942
+// { dg-do compile { target c++14 } }
+// { dg-options "-w" }
+
+int a(__attribute__((b((int)__builtin_inf() * 1ULL / auto))));
+// { dg-error "expected primary-expression before" "" { target *-*-* } .-1 }