Issue 143669
Summary [Clang] Alias template argument deduction is enabled in SFINAE contexts in C++17 mode
Labels clang:frontend, diverges-from:msvc
Assignees
Reporter frederick-vs-ja
    After #77890 (implementing [P1814R0](https://wg21.link/p1814r0)) and possibly #89358, Clang starts to report CTAD for alias template can be well-formed in immediate contexts even in C++17.

As a result, the following example starts to be rejected in C++17 mode since Clang 19. [Godbolt link](https://godbolt.org/z/nYnbs8nd9).
```C++
template <class T>
T quick_retval();

template <class, template<class> class Tmpl, class...Args>
constexpr bool CanCtadFromImpl = false;
template <template<class> class Tmpl, class...Args>
constexpr bool CanCtadFromImpl<
 decltype(static_cast<void>(Tmpl(::quick_retval<Args>()...))), Tmpl, Args...> = true;

template<template<class> class Tmpl, class...Args>
constexpr bool CanCtadFrom = CanCtadFromImpl<void, Tmpl, Args...>;

template <class T>
struct Foo {
  explicit Foo(T);
};

template <class T>
using AliasedFoo = Foo<T>;

static_assert(CanCtadFrom<Foo, int>);
static_assert(!CanCtadFrom<AliasedFoo, int>);
```

If I understand correctly, `CanCtadFrom<AliasedFoo, int>` should be `false` in C++17 and `true` in C++20 or later.

GCC and EDG seem to be consistent with Clang (i.e. making `CanCtadFrom<AliasedFoo, int>` `true` in C++17 mode), while MSVC makes `CanCtadFrom<AliasedFoo, int>` `false` in C++17 mode and `true` later.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to