[clang] [C2y] Correctly handle incomplete types in generic selections (PR #141596)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue May 27 07:28:50 PDT 2025


================
@@ -1874,9 +1874,11 @@ ExprResult Sema::CreateGenericSelectionExpr(
 
         if (D != 0) {
           Diag(Types[i]->getTypeLoc().getBeginLoc(), D)
-            << Types[i]->getTypeLoc().getSourceRange()
-            << Types[i]->getType();
-          TypeErrorFound = true;
+              << Types[i]->getTypeLoc().getSourceRange() << Types[i]->getType();
+          if (getDiagnostics().getDiagnosticLevel(
----------------
erichkeane wrote:

Well, we're asking the De the 'level' not really 'did you/would you emit an error for this'.  Leading me to believe we perhaps need some sort of `DiagnosticsEngine::isErrorDiagnostic` or something, but that is 1/2 baked here.  BUT something we should find ourselves thinking about if this happens more often.

https://github.com/llvm/llvm-project/pull/141596


More information about the cfe-commits mailing list