================
@@ -10163,6 +10163,16 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D,
DeclContext *DC,
}
ConstexprSpecKind ConstexprKind = D.getDeclSpec().getConstexprSpecifier();
+
+ // Clang's option -fimplicit-constexpr will make functions without
constexpr
+ // or consteval specifier implicitly constexpr (compatibility with GCC.)
+ if (ConstexprKind == ConstexprSpecKind::Unspecified &&
+ getLangOpts().ImplicitConstexpr) {
----------------
Sirraide wrote:
One thing worth pointing out is that GCC’s `-fimplicit-constexpr` only affects
`inline` functions. There are probably reasons for that but I don’t know if
they are an implementation detail or if the GCC devs had good reasons why this
wouldn’t be desirable for non-`inline` functions.
I personally think the flag isn’t that useful if it requires `inline`, because
if you have to write `inline` anyway, then you might as well just write
`constexpr` instead.
https://github.com/llvm/llvm-project/pull/136436
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits