Issue 149610
Summary Can't `#include <llvm/ADT/FloatingPointMode.h>` with `-std=c++23` with clang++ 21.1.0-rc1
Labels clang
Assignees
Reporter chriselrod
    ```c++
#include <llvm/ADT/FloatingPointMode.h>

int main(){
  return 0;
}
```
I get
```
❯ clang++ llvminclude.cpp

~/Documents/progwork/cxx/test
❯ clang++ -std=c++23 llvminclude.cpp
In file included from llvminclude.cpp:1:
In file included from /usr/include/llvm/ADT/FloatingPointMode.h:19:
In file included from /usr/include/llvm/ADT/StringSwitch.h:16:
/usr/include/llvm/ADT/StringRef.h:864:22: error: 'enable_if' attribute _expression_ never
      produces a constant _expression_
  864 |         __attribute((enable_if(__builtin_strlen(Str) == N - 1,
      |                      ^
/usr/include/llvm/ADT/FloatingPointMode.h:193:14: note: in instantiation of function
      template specialization 'llvm::StringLiteral::StringLiteral<1UL>' requested here
  193 |       .Cases("", "ieee", DenormalMode::IEEE)
      |              ^
/usr/include/llvm/ADT/StringRef.h:864:49: note: read of variable 'Str' whose value is not
      known
  864 |         __attribute((enable_if(__builtin_strlen(Str) == N - 1,
      |                                                 ^
/usr/include/llvm/ADT/StringRef.h:860:42: note: declared here
  860 |     constexpr StringLiteral(const char (&Str)[N])
      |                                          ^
/usr/include/llvm/ADT/StringRef.h:864:22: error: 'enable_if' attribute _expression_ never
      produces a constant _expression_
  864 |         __attribute((enable_if(__builtin_strlen(Str) == N - 1,
      |                      ^
/usr/include/llvm/ADT/FloatingPointMode.h:193:18: note: in instantiation of function
      template specialization 'llvm::StringLiteral::StringLiteral<5UL>' requested here
  193 |       .Cases("", "ieee", DenormalMode::IEEE)
      |                  ^
/usr/include/llvm/ADT/StringRef.h:864:49: note: read of variable 'Str' whose value is not
      known
  864 |         __attribute((enable_if(__builtin_strlen(Str) == N - 1,
      |                                                 ^
/usr/include/llvm/ADT/StringRef.h:860:42: note: declared here
  860 |     constexpr= StringLiteral(const char (&Str)[N])
      |                                          ^
/usr/include/llvm/ADT/StringRef.h:864:22: error: 'enable_if' attribute _expression_ never
      produces a constant _expression_
  864 |         __attribute((enable_if(__builtin_strlen(Str) == N - 1,
      |                      ^
/usr/include/llvm/ADT/FloatingPointMode.h:194:13: note: in instantiation of function
      template specialization 'llvm::StringLiteral::StringLiteral<14UL>' requested here
  194 |       .Case("preserve-sign", DenormalMode::PreserveSign)
      |             ^
/usr/include/llvm/ADT/StringRef.h:864:49: note: read of variable 'Str' whose value is not
      known
  864 |         __attribute((enable_if(__builtin_strlen(Str) == N - 1,
      |                                                 ^
/usr/include/llvm/ADT/StringRef.h:860:42: note: declared here
  860 |     constexpr StringLiteral(const char (&Str)[N])
      |                                          ^
/usr/include/llvm/ADT/StringRef.h:864:22: error: 'enable_if' attribute _expression_ never
      produces a constant _expression_
  864 |         __attribute((enable_if(__builtin_strlen(Str) == N - 1,
      |                      ^
/usr/include/llvm/ADT/FloatingPointMode.h:196:13: note: in instantiation of function
      template specialization 'llvm::StringLiteral::StringLiteral<8UL>' requested here
  196 |       .Case("dynamic", DenormalMode::Dynamic)
      |             ^
/usr/include/llvm/ADT/StringRef.h:864:49: note: read of variable 'Str' whose value is not
      known
  864 |         __attribute((enable_if(__builtin_strlen(Str) == N - 1,
      |                                                 ^
/usr/include/llvm/ADT/StringRef.h:860:42: note: declared here
  860 |     constexpr StringLiteral(const char (&Str)[N])
      |                                          ^
4 errors generated.
```

This works with clang++ 20.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to