[clang] [clang][Sema] Emit more specific diagnostic for auto in lambda before C++14 (#46059) (PR #68540)
Shafik Yaghmour via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 10 16:00:19 PDT 2023
================
@@ -3605,8 +3605,11 @@ static QualType GetDeclSpecTypeForDeclarator(TypeProcessingState &state,
Info = &SemaRef.InventedParameterInfos.back();
} else {
// In C++14, generic lambdas allow 'auto' in their parameters.
- if (!SemaRef.getLangOpts().CPlusPlus14 || !Auto ||
- Auto->getKeyword() != AutoTypeKeyword::Auto) {
+ if (!SemaRef.getLangOpts().CPlusPlus14 && Auto &&
+ Auto->getKeyword() == AutoTypeKeyword::Auto) {
+ Error = 24;
----------------
shafik wrote:
A lot of the other cases have comments explaining what diagnostic the code pertains to. See 20 or 7 below for example.
This is not really great but at least we have a guide to which diagnostic we intend to emit.
https://github.com/llvm/llvm-project/pull/68540
More information about the cfe-commits
mailing list