[PATCH] D113393: [c++2b] Implement P0849R8 auto(x)
Zhihao Yuan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 1 01:22:03 PST 2021
lichray marked an inline comment as done.
lichray added a comment.
I reverted the attempt to fix `auto(&a)->n = 0;` in this revision. The fix is definitely not 3 lines and does not fit in this patch.
Long story short, our tentative parsing code does not look at trailing return types and fails to disambiguate `template <class T> void e(auto (*p)(T y) -> decltype(y())) {}` if it is still ambiguous after seen `auto (`. The following files have more interesting cases:
CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p2.cpp
CXX/dcl/dcl.fct/p17.cpp
CodeGenCXX/mangle-exprs.cpp
Parser/cxx0x-ambig.cpp
Parser/cxx1z-decomposition.cpp
SemaCXX/trailing-return-0x.cpp
SemaTemplate/alias-templates.cpp
and not all of them are correct. It needs a closer look in a future issue.
================
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)).
+
----------------
rsmith wrote:
> We should produce an `ExtWarn` for this case.
Fixed. Now silenced in this file and produced somewhere else.
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