Issue |
150131
|
Summary |
clang-21 regression: "enable_if attribute _expression_ never produces a constant _expression_" when compiling LLVM in C++23
|
Labels |
new issue
|
Assignees |
|
Reporter |
vogelsgesang
|
The command
```
echo '#include "llvm/ADT/StringExtras.h"' | clang++-21 -x c++ - -I -std=c++23
```
fails with the compilation error
```
In file included from <stdin>:1:
In file included from ./llvm/include/llvm/ADT/StringExtras.h:19:
In file included from ./llvm/include/llvm/ADT/SmallString.h:18:
./llvm/include/llvm/ADT/StringRef.h:871:22: error: 'enable_if' attribute
_expression_ never produces a constant _expression_
871 | __attribute((enable_if(__builtin_strlen(Str) == N - 1,
| ^
./llvm/include/llvm/ADT/StringExtras.h:150:34: note: in instantiation of
function template specialization 'llvm::StringLiteral::StringLiteral<33UL>' requested here
150 | static constexpr StringLiteral Punctuations =
| ^
./llvm/include/llvm/ADT/StringRef.h:871:49: note: read of variable 'Str'
whose value is not known
871 | __attribute((enable_if(__builtin_strlen(Str) == N - 1,
| ^
./llvm/include/llvm/ADT/StringRef.h:867:42: note: declared here
867 | constexpr StringLiteral(const char (&Str)[N])
| ^
1 error generated.
```
Both clang-21 and the used LLVM source were taken from the 21.1.0-rc1 tag.
The same command works against clang++ version 20, as such this is a regression compared to clang-20.
(The issue goes away when using C++20 instead of C++23)
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs