================ @@ -14058,7 +14058,17 @@ void Sema::ActOnUninitializedDecl(Decl *RealDecl) { // C++1z [dcl.dcl]p1 grammar implies that an initializer is mandatory. if (isa<DecompositionDecl>(RealDecl)) { - Diag(Var->getLocation(), diag::err_decomp_decl_requires_init) << Var; + Preprocessor &PP = getPreprocessor(); + SourceManager &SM = Context.getSourceManager(); + LangOptions LO = Context.getLangOpts(); + + // Lexer previously checked for '=' and didn't find it + // Highlight the token found in its place in the error message + Token Tok; + Lexer::getRawToken(PP.getLastCachedTokenLocation(), Tok, SM, LO); ---------------- erichkeane wrote:
This whole bit here with the raw-token isn't right, and shouldn't be in Sema. We also can't count on the preprocessors 'last location' with templates, since we'll be at end of TU. Same with the `getSpelling` part. If we want to improve this diagnostic, we need tog et the information from the AST somehow. https://github.com/llvm/llvm-project/pull/127924 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits