[PATCH] D119778: [clang] Add a note "deducing return type for 'foo'"
Arthur O'Dwyer via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 14 14:01:00 PST 2022
Quuxplusone created this revision.
Quuxplusone added reviewers: sammccall, rsmith, dblaikie, majnemer, mizvekov, ChuanqiXu.
Quuxplusone added a project: clang.
Quuxplusone requested review of this revision.
Herald added a subscriber: cfe-commits.
Emit the note when we fail to deduce a return type, or deduce conflicting return types.
It's emitted a //little// too eagerly, e.g. I wish we could avoid it in cases like
$ bin/clang++ x.cpp
x.cpp:1:19: error: use of undeclared identifier 'x'
auto f() { return x; }
^
x.cpp:1:1: note: deducing return type for 'f'
auto f() { return x; }
^~~~
1 error generated.
But Clang doesn't seem to be able to distinguish "parsing and type-checking the return //expression//" from "deducing the function's actual return //type//," and I'm not inclined to dig this rabbit hole deeper than I already have. I think this is still a reasonably clean place to stop digging.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D119778
Files:
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Sema/SemaStmt.cpp
clang/test/Sema/invalid-bitwidth-expr.mm
clang/test/SemaCXX/cxx20-p0388-unbound-ary.cpp
clang/test/SemaCXX/cxx2b-consteval-if.cpp
clang/test/SemaCXX/deduced-return-type-cxx14.cpp
clang/test/SemaCXX/deduced-return-void.cpp
clang/test/SemaCXX/std-compare-cxx2a.cpp
clang/test/SemaCXX/typo-correction-crash.cpp
clang/test/SemaOpenCLCXX/template-astype.cl
clang/test/SemaTemplate/concepts.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119778.408609.patch
Type: text/x-patch
Size: 16747 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220214/afa63791/attachment-0001.bin>
More information about the cfe-commits
mailing list