[PATCH] D113393: [c++2b] Implement P0849R8 auto(x)
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 10 05:53:44 PST 2022
aaron.ballman added inline comments.
================
Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:2396
+def ext_decltype_auto_expr : ExtWarn<
+ "ISO C++23 DIS does not allow functional-style cast to 'decltype(auto)'">,
+ InGroup<DiagGroup<"decltype-auto-cast">>;
----------------
Is there a reason this one should be `ExtWarn` instead of `Extension`? (I think we typically only issue this kind of diagnostic when `-pedantic` is specified.)
================
Comment at: clang/lib/Parse/ParseDeclCXX.cpp:1035
+ // the typename-specifier in a function-style cast expression may
+ // be 'auto' since C++2b
Diag(Tok.getLocation(),
----------------
================
Comment at: clang/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.auto.deduct/p2.cpp:4
+// p2.3 allows only T = auto in T(x).
+// As a Clang extension, we also allow T = decltype(auto) to match p2.2 (new T(x)).
+
----------------
lichray wrote:
> rsmith wrote:
> > We should produce an `ExtWarn` for this case.
> Fixed. Now silenced in this file and produced somewhere else.
> We should produce an ExtWarn for this case.
Can you help me understand our rule for when to use `ExtWarn` vs `Extension` for this? I was under the impression we used `Extension` for this sort of thing, and only used `ExtWarn` in the cases where the use of the extension is wrong and the warning should be on by default.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113393/new/
https://reviews.llvm.org/D113393
More information about the cfe-commits
mailing list