[AST][RecoveryExpr] Make DeduceAutoType fail if the auto is deduced from recovery...
authorHaojian Wu <hokein.wu@gmail.com>
Tue, 19 May 2020 16:05:15 +0000 (18:05 +0200)
committerHaojian Wu <hokein.wu@gmail.com>
Fri, 29 May 2020 07:54:28 +0000 (09:54 +0200)
commit82bb57c11d8ccb4e1b0f420f4388dd6553bbc57a
treec0000bd13969f45068fd37ee38965543655bc094
parent7fb8a40e5220d6d4efa14c15f92b6f28ba1b18f7
[AST][RecoveryExpr] Make DeduceAutoType fail if the auto is deduced from recovery exprs.

Summary:
With recovery-ast, we will get an undeduced `auto` return type for
"auto foo()->undef()" function declaration, the function decl still keeps
valid, it is dangerous, and breaks assumptions in clang, and leads crashes.

This patch invalidates these functions, if we deduce autos from the
return rexpression, which is similar to auto VarDecl.

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D80221
clang/lib/Sema/SemaStmt.cpp
clang/lib/Sema/SemaTemplateDeduction.cpp
clang/test/AST/ast-dump-invalid-auto-return-funcs.cpp [new file with mode: 0644]
clang/test/AST/ast-dump-recovery.cpp
clang/test/Sema/invalid-bitwidth-expr.mm