From f494ac0ebd96a964914b7d9cc7b208a69865f9f1 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 10 Feb 2017 13:24:36 -0500 Subject: [PATCH] PR c++/71285 - member of fold-expression * semantics.c (finish_unary_fold_expr) (finish_binary_fold_expr): Use null type for fold-expressions. From-SVN: r245340 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/semantics.c | 4 ++-- gcc/testsuite/g++.dg/cpp1z/fold9.C | 12 ++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp1z/fold9.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 688a3bce86e..68c5d9d1cd9 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2017-02-10 Jason Merrill + 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. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index e9fc4aa2797..6a47476b336 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -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 index 00000000000..578b8d03ca6 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/fold9.C @@ -0,0 +1,12 @@ +// PR c++/71285 +// { dg-options -std=c++1z } + +template +void spurious(Args... args) +{ + (... + args).member; +} + +int main() +{ +} -- 2.30.2