PR c++/71285 - member of fold-expression
authorJason Merrill <jason@redhat.com>
Fri, 10 Feb 2017 18:24:36 +0000 (13:24 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 10 Feb 2017 18:24:36 +0000 (13:24 -0500)
* semantics.c (finish_unary_fold_expr)
(finish_binary_fold_expr): Use null type for fold-expressions.

From-SVN: r245340

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/g++.dg/cpp1z/fold9.C [new file with mode: 0644]

index 688a3bce86ee1adbd0df5ae1cd0b9923a171c591..68c5d9d1cd9a5bdf39dc4309b530689e63528426 100644 (file)
@@ -1,5 +1,9 @@
 2017-02-10  Jason Merrill  <jason@redhat.com>
 
+       PR c++/71285 - member of fold-expression
+       * semantics.c (finish_unary_fold_expr)
+       (finish_binary_fold_expr): Use null type for fold-expressions.
+
        PR c++/79401 - protected inherited constructor
        * call.c (enforce_access): For inheriting constructor, find a base
        binfo in the path we already have.
index e9fc4aa27977b61492e773d38ddee90e5cfb0b12..6a47476b33643d02f662ec654ae5ee9f6b7491f5 100644 (file)
@@ -9437,7 +9437,7 @@ finish_unary_fold_expr (tree expr, int op, tree_code dir)
 
   // Build the fold expression.
   tree code = build_int_cstu (integer_type_node, abs (op));
-  tree fold = build_min (dir, unknown_type_node, code, pack);
+  tree fold = build_min_nt_loc (UNKNOWN_LOCATION, dir, code, pack);
   FOLD_EXPR_MODIFY_P (fold) = (op < 0);
   return fold;
 }
@@ -9463,7 +9463,7 @@ finish_binary_fold_expr (tree pack, tree init, int op, tree_code dir)
 {
   pack = make_pack_expansion (pack);
   tree code = build_int_cstu (integer_type_node, abs (op));
-  tree fold = build_min (dir, unknown_type_node, code, pack, init);
+  tree fold = build_min_nt_loc (UNKNOWN_LOCATION, dir, code, pack, init);
   FOLD_EXPR_MODIFY_P (fold) = (op < 0);
   return fold;
 }
diff --git a/gcc/testsuite/g++.dg/cpp1z/fold9.C b/gcc/testsuite/g++.dg/cpp1z/fold9.C
new file mode 100644 (file)
index 0000000..578b8d0
--- /dev/null
@@ -0,0 +1,12 @@
+// PR c++/71285
+// { dg-options -std=c++1z }
+
+template<typename... Args>
+void spurious(Args... args)
+{
+    (... + args).member;
+}
+
+int main()
+{
+}