[clang] [clang-tools-extra] [clang] Implement CWG2398 provisional TTP matching to class templates (PR #92855)

2024-05-21 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov edited 
https://github.com/llvm/llvm-project/pull/92855
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [clang] Implement CWG2398 provisional TTP matching to class templates (PR #92855)

2024-05-22 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov edited 
https://github.com/llvm/llvm-project/pull/92855
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [clang] Implement CWG2398 provisional TTP matching to class templates (PR #92855)

2024-05-22 Thread Matheus Izvekov via cfe-commits

https://github.com/mizvekov closed 
https://github.com/llvm/llvm-project/pull/92855
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [clang] Implement CWG2398 provisional TTP matching to class templates (PR #92855)

2024-05-23 Thread James Y Knight via cfe-commits

jyknight wrote:

Heads up: this commit has triggered some weird errors for a compile, but only 
when clang header modules are enabled. A std::vector, that's built through a 
large amount of template gunk that definitely involves template template 
parameter matching, ends up failing vector's "Allocator::value_type must be 
same type as value_type" static assertion -- the vector's allocator's 
value_type seems to be some unrelated type. But, only when modules are enabled.

That seems to _probably_ indicate a bug in this commit (presumably related to 
AST serialization or deserialization?), but I don't have a test-case, and, 
that's harder to get for issues that only arise with modules enabled...

If this very vague and unhelpful description makes you think "oh, I see where 
the problem likely is!", then great! But, otherwise, I'll see if I can create a 
test case...

https://github.com/llvm/llvm-project/pull/92855
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [clang] Implement CWG2398 provisional TTP matching to class templates (PR #92855)

2024-05-23 Thread Davide Italiano via cfe-commits

dcci wrote:

I am seeing something similar in vector (without modules). I'm reducing a test 
case now.

https://github.com/llvm/llvm-project/pull/92855
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [clang] Implement CWG2398 provisional TTP matching to class templates (PR #92855)

2024-05-23 Thread Davide Italiano via cfe-commits

dcci wrote:

Example error while I reduce:

```
fbcode/third-party-buck/platform010/build/libgcc/include/c++/trunk/bits/stl_vector.h:404:21:
 error: static assertion failed due to requirement 
'is_same, std::allocator>, 
quic::Interval>::value': std::vector must have the same 
value_type as its allocator
  404 |   static_assert(is_same::value,
  | ^~~~
buck-out/v2/gen/fbcode/21eca57c08ba71f9/quic/common/__interval_set__/buck-headers/quic/common/IntervalSet.h:61:29:
 note: in instantiation of template class 'std::vector>' requested here
   61 | class IntervalSet : private Container> {
  | ^
buck-out/v2/gen/fbcode/21eca57c08ba71f9/quic/state/__quic_state_machine__/buck-headers/quic/state/QuicStreamManager.h:79:41:
 note: in instantiation of template class 'quic::IntervalSet' requested here
   79 |   IntervalSet streams_;
  | ^
```

https://github.com/llvm/llvm-project/pull/92855
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [clang] Implement CWG2398 provisional TTP matching to class templates (PR #92855)

2024-05-23 Thread Matheus Izvekov via cfe-commits

mizvekov wrote:

Thanks for the heads up, this does look like a problem. I am reverting it for 
now.

https://github.com/llvm/llvm-project/pull/92855
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [clang] Implement CWG2398 provisional TTP matching to class templates (PR #92855)

2024-05-23 Thread Matheus Izvekov via cfe-commits

mizvekov wrote:

> Heads up: this commit has triggered some weird errors for a compile, but only 
> when clang header modules are enabled. 
> That seems to _probably_ indicate a bug in this commit (presumably related to 
> AST serialization or deserialization?), but I don't have a test-case, and, 
> that's harder to get for issues that only arise with modules enabled...

Thanks for the heads-up, James.

Indeed, and it's not only modules, our tooling for reducing test cases is 
getting less and less effective.

https://github.com/llvm/llvm-project/pull/92855
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [clang] Implement CWG2398 provisional TTP matching to class templates (PR #92855)

2024-05-23 Thread Matheus Izvekov via cfe-commits

mizvekov wrote:

I figured a reproducer based on your hints:

```C++
template struct A {};

template class TT> auto f(TT a) { return a; }

A v1;
A v2;

using X = decltype(f(v1));
using Y = decltype(f(v2));
```

Fails with:
```
t.cc:9:20: error: no matching function for call to 'f'
9 | using Y = decltype(f(v2));
  |^
t.cc:3:41: note: candidate template ignored: deduced type 'A<[...], (default) 
float>' of 1st parameter does not match adjusted type 'A<[...], double>' of 
argument [with TT = A]
3 | template class TT> auto f(TT a) { return a; }
  | ^
```

This shows we are not properly canonicalizing the synthesized template 
declaration.

The problem does not show up with class template partial specializations due to 
a pre-existing issue, but otherwise this was an oversight on my part.

No need to keep reducing on your end, I already have enough to go with.

https://github.com/llvm/llvm-project/pull/92855
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits