diff options
author | Patrick Palka <ppalka@redhat.com> | 2022-05-03 15:21:26 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2022-05-03 15:21:26 -0400 |
commit | a16fc9f1c96c7361d0b7a83a06f3649ace6c440d (patch) | |
tree | 01f249f3cd129ae610347d2ac1d0d4d9cd195a61 /gcc/cp/cp-tree.h | |
parent | 5609bcd620132c290820cccd871a6d7cbf39b785 (diff) | |
download | gcc-a16fc9f1c96c7361d0b7a83a06f3649ace6c440d.zip gcc-a16fc9f1c96c7361d0b7a83a06f3649ace6c440d.tar.gz gcc-a16fc9f1c96c7361d0b7a83a06f3649ace6c440d.tar.bz2 |
c++: make finish_non_static_data_member SFINAE enabled [PR105351]
Here since finish_non_static_data_member isn't SFINAE enabled, we
incorrectly emit an error when considering the first overload rather
than silently discarding it:
sfinae33.C: In substitution of ‘template<class T> A<T::value> f() [with T = B]’:
sfinae33.C:11:7: required from here
sfinae33.C:5:31: error: invalid use of non-static data member ‘B::value’
5 | template<class T> A<T::value> f();
| ^
This patch makes the function SFINAE enabled in the usual way: give it a
complain parameter, check it before emitting an error, and pass it through
appropriately.
PR c++/105351
gcc/cp/ChangeLog:
* cp-tree.h (finish_non_static_data_member): Add defaulted
complain parameter.
* pt.cc (tsubst_copy_and_build): Pass complain to
finish_non_static_data_member.
* semantics.cc (finish_non_static_data_member): Respect complain
parameter.
(finish_qualified_id_expr): Pass complain to
finish_non_static_data_member.
gcc/testsuite/ChangeLog:
* g++.dg/template/sfinae33.C: New test.
Diffstat (limited to 'gcc/cp/cp-tree.h')
-rw-r--r-- | gcc/cp/cp-tree.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 6de29c0..8d7cf24 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -7615,7 +7615,8 @@ inline tree force_paren_expr_uneval (tree t) { return force_paren_expr (t, true); } extern tree maybe_undo_parenthesized_ref (tree); extern tree maybe_strip_ref_conversion (tree); -extern tree finish_non_static_data_member (tree, tree, tree); +extern tree finish_non_static_data_member (tree, tree, tree, + tsubst_flags_t = tf_warning_or_error); extern tree begin_stmt_expr (void); extern tree finish_stmt_expr_expr (tree, tree); extern tree finish_stmt_expr (tree, bool); |