https://bugs.llvm.org/show_bug.cgi?id=51503
Bug ID: 51503
Summary: [concepts] substitution into constraint expression
resulted in a non-constant expression
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++2a
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected]
Hi clang-team,
the following code does not compile with clang trunk:
```c++
template <typename urng_t>
struct contiguous_range
{
template <bool const_range>
requires (const_range == false)
using basic_iterator = int;
auto begin()
{
return basic_iterator<false>{};
}
};
```
https://godbolt.org/z/jobYveoe3
with the error
```
<source>:5:19: error: substitution into constraint expression resulted in a
non-constant expression
requires (const_range == false)
^~~~~~~~~~~~~~~~~~~~
<source>:10:16: note: while checking constraint satisfaction for template
'basic_iterator<false>' required here
return basic_iterator<false>{};
^~~~~~~~~~~~~~~~~~~~~
<source>:5:19: note: subexpression not valid in a constant expression
requires (const_range == false)
^
```
MSVC 16.11, and gcc 11.2 are able to compile this code. A curious side note: If
you remove `template <typename urng_t>` clang does compile this code snippet.
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs