-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Closed
llvm/llvm-project-release-prs
#321Labels
c++20clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"conceptsC++20 conceptsC++20 conceptsconfirmedVerified by a second partyVerified by a second partyregressionrelease:backportrelease:merged
Milestone
Description
template<typename... Ts>
constexpr bool True() { return true; }
template<typename T>
class A {
public:
template<typename... Ts>
A(T val, Ts... tail)
requires (True<Ts...>())
{}
};
int main() {
A b(42);
}Works on GCC, MSVC, and Clang 15.0.0. But on 17.0.0-26662ac010ef50e65e2774eab84f325aa09360fe, it fails with
<source>:9:15: error: substitution into constraint expression resulted in a non-constant expression
requires (True<Ts...>())
^~~~~~~~~~~~~
<source>:14:7: note: while checking constraint satisfaction for template '<deduction guide for A><int>' required here
A b(42);
^
<source>:14:7: note: in instantiation of function template specialization '<deduction guide for A><int>' requested here
<source>:9:15: note: non-literal type '<dependent type>' cannot be used in a constant expression
requires (True<Ts...>())
^
<source>:14:7: error: no viable constructor or deduction guide for deduction of template arguments of 'A'
A b(42);
^
<source>:8:5: note: candidate template ignored: failed template argument deduction
A(T val, Ts... tail)
^
<source>:5:7: note: candidate template ignored: could not match 'A<T>' against 'int'
class A {
^https://godbolt.org/z/sh7TrPGE1
I also found an ICE-on-invalid that I suspect may have the same root cause and/or same solution: https://godbolt.org/z/7qGTddsYh If it doesn't, feel free to ignore it; if this bug is fixed but the ICE remains, I'll file a new bug.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
c++20clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"conceptsC++20 conceptsC++20 conceptsconfirmedVerified by a second partyVerified by a second partyregressionrelease:backportrelease:merged
Type
Projects
Status
Done
Status
No status