diff options
author | Jason Merrill <jason@redhat.com> | 2025-01-27 12:04:13 -0500 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2025-01-27 18:01:56 -0500 |
commit | c7f16806f3cc8011a3e1bbbf59389df65087f330 (patch) | |
tree | 4cca1277ec2b93040a118e8c68f2185f354a1079 /gcc/testsuite/g++.dg/cpp0x | |
parent | 019fe9c4d4c7cc9e325b5460d277ebaec108a838 (diff) | |
download | gcc-c7f16806f3cc8011a3e1bbbf59389df65087f330.zip gcc-c7f16806f3cc8011a3e1bbbf59389df65087f330.tar.gz gcc-c7f16806f3cc8011a3e1bbbf59389df65087f330.tar.bz2 |
c++: only strip conversions for deduction [PR118632]
In r15-2761 I changed unify to always strip IMPLICIT_CONV_EXPR from PARM.
In this testcase that leads to comparing nullptr to (int*)0, and failing
because they aren't the same. Let's only strip conversions if we're
actually going to try to deduce template arguments.
While we're at it, let's move this after the early exits.
And with this adjustment we can remove the workaround for mangle57.C.
PR c++/118632
gcc/cp/ChangeLog:
* pt.cc (unify): Only strip conversion if deducible_expression.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/nontype7.C: New test.
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp0x')
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/nontype7.C | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/nontype7.C b/gcc/testsuite/g++.dg/cpp0x/nontype7.C new file mode 100644 index 0000000..30c1d39 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/nontype7.C @@ -0,0 +1,13 @@ +// PR c++/118632 +// { dg-do compile { target c++11 } } + +template<class T, T* = nullptr> +class Matrix {}; + +template<class T> +void operator*(Matrix<T>, int); + +int main() { + Matrix<int> m; + m * 42; +} |