[concepts] [ice] substitution into constraint expression resulted in a non-constant expression #50845
Closed
Description
| Bugzilla Link | 51503 |
| Version | trunk |
| OS | Linux |
| CC | @AaronBallman,@JohelEGP,@zygoloid |
Extended Description
Hi clang-team,
the following code does not compile with clang trunk:
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.
Metadata
Assignees
Labels
Type
Projects
Status
Done
Activity