[clang] [Clang] Add attribute for consteval builtins; Declare constexpr builtins as constexpr in C++ (PR #91894)

Mital Ashok via cfe-commits cfe-commits at lists.llvm.org
Tue May 14 10:23:52 PDT 2024


================
@@ -14,13 +14,18 @@ void __builtin_va_copy(double d);
 // expected-error at +2 {{cannot redeclare builtin function '__builtin_va_end'}}
 // expected-note at +1 {{'__builtin_va_end' is a builtin with type}}
 void __builtin_va_end(__builtin_va_list);
-// RUN: %clang_cc1 %s -fsyntax-only -verify 
-// RUN: %clang_cc1 %s -fsyntax-only -verify -x c
 
 void __va_start(__builtin_va_list*, ...);
 
+          void *__builtin_assume_aligned(const void *, size_t, ...);
 #ifdef __cplusplus
-void *__builtin_assume_aligned(const void *, size_t, ...) noexcept;
-#else
-void *__builtin_assume_aligned(const void *, size_t, ...);
+constexpr void *__builtin_assume_aligned(const void *, size_t, ...);
+          void *__builtin_assume_aligned(const void *, size_t, ...) noexcept;
+constexpr void *__builtin_assume_aligned(const void *, size_t, ...) noexcept;
+          void *__builtin_assume_aligned(const void *, size_t, ...) throw();
+constexpr void *__builtin_assume_aligned(const void *, size_t, ...) throw();
+
----------------
MitalAshok wrote:

That seems like that should go in a separate patch. For now, I'll change this one so `ConstexprSpecKind::Constexpr` isn't added to these builtins as before

https://github.com/llvm/llvm-project/pull/91894


More information about the cfe-commits mailing list