[PATCH] D77598: Integral template argument suffix and cast printing
Arthur O'Dwyer via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Jul 5 12:15:45 PDT 2020
Quuxplusone added inline comments.
================
Comment at: clang/test/SemaTemplate/matrix-type.cpp:77
void use_matrix_3(matrix<T, R - 2, R> &m) {}
-// expected-note at -1 {{candidate template ignored: deduced type 'matrix<[...], 5UL - 2, 5UL>' of 1st parameter does not match adjusted type 'matrix<[...], 5, 5>' of argument [with T = unsigned int, R = 5]}}
+// expected-note at -1 {{candidate template ignored: deduced type 'matrix<[...], 5UL - 2, 5UL>' of 1st parameter does not match adjusted type 'matrix<[...], 5, 5>' of argument [with T = unsigned int, R = 5UL]}}
----------------
Re clarifying Richard's comment: My initial reaction is that every diff in this file is unwanted. The old output was unambiguous, despite lacking suffixes.
However, consider the following silly error message from Clang trunk. This is what we hope to //avoid// after this patch, I assume:
```
// https://godbolt.org/z/6nGmkE
template<auto N> struct S {};
template<> struct S<1> { using type = int; };
S<1L>::type t;
error: no type named 'type' in 'S<1>'; did you mean 'S<1>::type'?
```
================
Comment at: clang/test/SemaTemplate/temp_arg_nontype.cpp:280
+ template <> struct enable_if_unsigned_int<1> { typedef int type; }; // expected-note{{'enable_if_unsigned_int<1>::type' declared here}}
+ void test_unsigned_int() { enable_if_unsigned_int<2>::type i; } // expected-error{{enable_if_unsigned_int<2U>'; did you mean 'enable_if_unsigned_int<1>::type'?}}
+
----------------
Re clarifying Richard's comment: I believe that Richard wants this to produce `enable_if_unsigned_int<2>'; did you mean` instead of `enable_if_unsigned_int<2U>'; did you mean`.
It looks to me like Clang is producing the shorter version when it prints out the corrected type `enable_if_unsigned_int<1>`, but not when it prints out the faulty type `enable_if_unsigned_int<2U>`. So maybe you addressed his comment in one place but not the other?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77598/new/
https://reviews.llvm.org/D77598
More information about the cfe-commits
mailing list