[Bug c++/119343] No SFINAE for deleted explicit specializations

2026-07-30 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119343

--- Comment #7 from GCC Commits  ---
The releases/gcc-16 branch has been updated by Patrick Palka
:

https://gcc.gnu.org/g:8491b800473971ba1c03e74866273cb8dcaa5edc

commit r16-9470-g8491b800473971ba1c03e74866273cb8dcaa5edc
Author: Patrick Palka 
Date:   Thu Jul 30 21:18:38 2026 -0400

c++: resolvedness of resolve_nondeduced_context result [PR126406]

In r16-5967-gbae0ed69e1862a we removed the mark_used call from
resolve_nondeduced_context under the rationale that it should be
the caller's responsiblity to mark_used.

Removing the call however now means that resolve_nondeduced_context
could return a specialization whose type is not yet fully resolved
(i.e. has an uninstantiated noexcept or undeduced return type), and
callers that immediately inspect TREE_TYPE of the result (such as
standard_conversion and build_conditional_expr) now misbehave.

In light of such callers, this patch reverts r16-5967; it's not
necessary to fix PR119343 because after r16-6276 convert_to_void
now properly propagates an error_mark_node result from
resolve_nondeduced_context.

PR c++/126406
PR c++/119343

gcc/cp/ChangeLog:

* pt.cc (resolve_nondeduced_context): Revert r16-5967 change.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/cond2a.C: New test.
* g++.dg/cpp1y/auto-fn67.C: New test.
* g++.dg/cpp1z/noexcept-type29.C: New test.

Reviewed-by: Jason Merrill 
(cherry picked from commit e873aac49eb2b58ae18e05f4150826278bdbb3cb)

[Bug c++/119343] No SFINAE for deleted explicit specializations

2026-07-30 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119343

--- Comment #6 from GCC Commits  ---
The master branch has been updated by Patrick Palka :

https://gcc.gnu.org/g:e873aac49eb2b58ae18e05f4150826278bdbb3cb

commit r17-2839-ge873aac49eb2b58ae18e05f4150826278bdbb3cb
Author: Patrick Palka 
Date:   Thu Jul 30 21:18:38 2026 -0400

c++: resolvedness of resolve_nondeduced_context result [PR126406]

In r16-5967-gbae0ed69e1862a we removed the mark_used call from
resolve_nondeduced_context under the rationale that it should be
the caller's responsiblity to mark_used.

Removing the call however now means that resolve_nondeduced_context
could return a specialization whose type is not yet fully resolved
(i.e. has an uninstantiated noexcept or undeduced return type), and
callers that immediately inspect TREE_TYPE of the result (such as
standard_conversion and build_conditional_expr) now misbehave.

In light of such callers, this patch reverts r16-5967; it's not
necessary to fix PR119343 because after r16-6276 convert_to_void
now properly propagates an error_mark_node result from
resolve_nondeduced_context.

PR c++/126406
PR c++/119343

gcc/cp/ChangeLog:

* pt.cc (resolve_nondeduced_context): Revert r16-5967 change.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/cond2a.C: New test.
* g++.dg/cpp1y/auto-fn67.C: New test.
* g++.dg/cpp1z/noexcept-type29.C: New test.

Reviewed-by: Jason Merrill 

[Bug c++/119343] No SFINAE for deleted explicit specializations

2025-12-08 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119343

Patrick Palka  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED
   Target Milestone|--- |16.0

--- Comment #5 from Patrick Palka  ---
Fixed for GCC 16

[Bug c++/119343] No SFINAE for deleted explicit specializations

2025-12-08 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119343

--- Comment #4 from GCC Commits  ---
The master branch has been updated by Patrick Palka :

https://gcc.gnu.org/g:bae0ed69e1862add152f1b0618148f931611a9ca

commit r16-5967-gbae0ed69e1862add152f1b0618148f931611a9ca
Author: Egas Ribeiro 
Date:   Sun Dec 7 23:35:00 2025 +

c++: Fix SFINAE for deleted explicit specializations [PR119343]

When checking a deleted explicit specialization in a SFINAE context,
we were incorrectly selecting a partial specialization because
resolve_nondeduced_context was calling mark_used.  But resolving an
overload to a single function (per DR 115) does not constitute ODR-use,
so mark_used shouldn't be called there.  Instead callers should call
mark_used or mark_single_function on the result to uniformly handle all
resolvable overloads (even non-template-id ones).

This turns out to fix the below testcase because it causes convert_to_void
for void(X::template g<0>) to properly propagate ODR-use failure (due to
deleted g<0>) and return error_mark_node instead of returning void_node.

PR c++/119343

gcc/cp/ChangeLog:

* pt.cc (resolve_nondeduced_context): Remove mark_used call.

gcc/testsuite/ChangeLog:

* g++.dg/template/sfinae-deleted-pr119343.C: New test.

Signed-off-by: Egas Ribeiro 
Reviewed-by: Patrick Palka 

[Bug c++/119343] No SFINAE for deleted explicit specializations

2025-11-30 Thread egas.g.ribeiro at tecnico dot ulisboa.pt via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119343

--- Comment #3 from Egas  Ribeiro  ---
Patch submitted:
https://gcc.gnu.org/pipermail/gcc-patches/2025-November/702436.html

[Bug c++/119343] No SFINAE for deleted explicit specializations

2025-11-21 Thread nshead at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119343

Nathaniel Shead  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |egas.g.ribeiro at 
tecnico dot ulis
   ||boa.pt
 CC||nshead at gcc dot gnu.org

[Bug c++/119343] No SFINAE for deleted explicit specializations

2025-03-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119343

Andrew Pinski  changed:

   What|Removed |Added

 Ever confirmed|0   |1
   Last reconfirmed||2025-03-17
   Keywords||rejects-valid
 Status|UNCONFIRMED |NEW

--- Comment #2 from Andrew Pinski  ---
Confirmed.

[Bug c++/119343] No SFINAE for deleted explicit specializations

2025-03-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119343

--- Comment #1 from Andrew Pinski  ---
4.8.0 used to do something similar for has_f too. Maybe that can help someone.