[Bug c++/124173] [16 Regression] template argument deduction/substitution failed with nullptr_t in C++11/14 since r16-7582
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Feb 22 21:11:57 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124173
--- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:37738f0422aa4d70ac5a71bd82b6c257a9309bde
commit r16-7630-g37738f0422aa4d70ac5a71bd82b6c257a9309bde
Author: Jakub Jelinek <jakub@redhat.com>
Date: Sun Feb 22 22:09:13 2026 +0100
c++: Fix up recent regression in convert_nontype_argument for C++1[14]
[PR124173]
The following testcase is rejected since my recent convert_nontype_argument
change, but only in C++11/14 modes.
The problem is that C++17 says that all NTTPs should be converted constant
expressions, but C++11 only said that for integral and enumeration ones and
something that applied to the decltype(nullptr) case was
- a constant expression that evaluates to a null pointer value
The problem is that for NULLPTR_TYPE_P for C++11/14, we just never called
maybe_constant_value, so obviously just making sure it is integer_zerop and
without tf_error returning NULL_TREE otherwise changes behavior on valid
programs, we really need to constant evaluate it first.
The following patch fixes that.
I'm afraid I actually don't know what exactly C++14 specifies, whether I've
grabbed a pre-C++14 or post-C++14 draft, which looked like the C++17
wording. So, if C++14 needs something different, we'll need a further
change, but this at least fixes the regression.
2026-02-22 Jakub Jelinek <jakub@redhat.com>
PR c++/124173
* pt.cc (convert_nontype_argument): For C++11/C++14 handle
NULLPTR_TYPE_P non-type arguments like TYPE_PTR_P.
* g++.dg/cpp0x/pr124173.C: New test.
More information about the Gcc-bugs
mailing list