[PATCH] D124666: In MSVC compatibility mode, handle unqualified templated base class initialization

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 3 15:59:36 PDT 2022


rnk added inline comments.


================
Comment at: clang/lib/Sema/SemaDeclCXX.cpp:4310-4311
 
       // If no results were found, try to correct typos.
       TypoCorrection Corr;
       MemInitializerValidatorCCC CCC(ClassDecl);
----------------
rnk wrote:
> We have to make sure our MS compatibility logic fires *before* we try to correct typos. It's currently a big issue that we don't. You can try adjusting your test case by adding a similarly named class like `Baze` and see if you still get the desired behavior.
> 
> See this old issue from 2014:
> https://github.com/llvm/llvm-project/issues/20623
What I'd like to see is just to move the MSVCCompat check up before the typo correction. Basically, once we start typo correction, we *must* emit an error diagnostic. We may attempt to recover by returning a recovery AST node, but the compilation should fail overall.

I think in practice, we only do typo correction if lookup is empty, and your code only fires if name lookup returns a single result, so it's functionally equivalent to reorder these codepaths. I'd prefer that structure, mostly for readability.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124666/new/

https://reviews.llvm.org/D124666



More information about the cfe-commits mailing list