Skip to content

Implement CWG2369 #54440

Open
@gonzalobg

Description

@gonzalobg

From http://wg21.link/cwg2369 , https://gcc.godbolt.org/z/nEqhM5dsG
The changes are already in the draft, starting here (https://eel.is/c++draft/temp.deduct.general#5.sentence-8) till the end of that paragraph.

template <class T> struct Z {
  typedef typename T::x xx;
};
template <class T> concept C = requires { typename T::A; };
template <C T> typename Z<T>::xx f(void *, T); // #1
template <class T> void f(int, T);             // #2
struct A {} a;
struct ZZ {
    template <class T, class = typename Z<T>::xx> operator T *();
    operator int();
};
int main() {
    ZZ zz;
    f(1, a);   // OK, deduction fails for #1 because there is no conversion from int to void*
    f(zz, 42); // OK, deduction fails for #1 because C<int> is not satisfied
}

compiles with GCC 11 and newer, but fails with clang-trunk and GCC 10 and older because they don't implement the CWG2369.

Metadata

Metadata

Assignees

Labels

clang:frontendLanguage frontend issues, e.g. anything involving "Sema"conceptsC++20 concepts

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions