EricWF updated this revision to Diff 74112.
EricWF added a comment.

Simplify test case.


https://reviews.llvm.org/D25430

Files:
  lib/Sema/SemaDeclCXX.cpp
  test/SemaCXX/using-decl-templates.cpp


Index: test/SemaCXX/using-decl-templates.cpp
===================================================================
--- test/SemaCXX/using-decl-templates.cpp
+++ test/SemaCXX/using-decl-templates.cpp
@@ -92,3 +92,12 @@
 
   template struct APtr<int>; // expected-error{{elaborated type refers to a 
type alias template}}
 }
+
+namespace DontDiagnoseInvalidTest {
+template <bool Value> struct Base {
+  static_assert(Value, ""); // expected-error {{static_assert failed}}
+};
+struct Derived : Base<false> { // expected-note {{requested here}}
+  using Base<false>::Base; // OK. Don't diagnose that 'Base' isn't a base 
class of Derived.
+};
+} // namespace DontDiagnoseInvalidTest
Index: lib/Sema/SemaDeclCXX.cpp
===================================================================
--- lib/Sema/SemaDeclCXX.cpp
+++ lib/Sema/SemaDeclCXX.cpp
@@ -9462,11 +9462,13 @@
         return true;
       }
 
-      Diag(SS.getRange().getBegin(),
-           diag::err_using_decl_nested_name_specifier_is_not_base_class)
-        << SS.getScopeRep()
-        << cast<CXXRecordDecl>(CurContext)
-        << SS.getRange();
+      if (!cast<CXXRecordDecl>(NamedContext)->isInvalidDecl()) {
+        Diag(SS.getRange().getBegin(),
+             diag::err_using_decl_nested_name_specifier_is_not_base_class)
+          << SS.getScopeRep()
+          << cast<CXXRecordDecl>(CurContext)
+          << SS.getRange();
+      }
       return true;
     }
 


Index: test/SemaCXX/using-decl-templates.cpp
===================================================================
--- test/SemaCXX/using-decl-templates.cpp
+++ test/SemaCXX/using-decl-templates.cpp
@@ -92,3 +92,12 @@
 
   template struct APtr<int>; // expected-error{{elaborated type refers to a type alias template}}
 }
+
+namespace DontDiagnoseInvalidTest {
+template <bool Value> struct Base {
+  static_assert(Value, ""); // expected-error {{static_assert failed}}
+};
+struct Derived : Base<false> { // expected-note {{requested here}}
+  using Base<false>::Base; // OK. Don't diagnose that 'Base' isn't a base class of Derived.
+};
+} // namespace DontDiagnoseInvalidTest
Index: lib/Sema/SemaDeclCXX.cpp
===================================================================
--- lib/Sema/SemaDeclCXX.cpp
+++ lib/Sema/SemaDeclCXX.cpp
@@ -9462,11 +9462,13 @@
         return true;
       }
 
-      Diag(SS.getRange().getBegin(),
-           diag::err_using_decl_nested_name_specifier_is_not_base_class)
-        << SS.getScopeRep()
-        << cast<CXXRecordDecl>(CurContext)
-        << SS.getRange();
+      if (!cast<CXXRecordDecl>(NamedContext)->isInvalidDecl()) {
+        Diag(SS.getRange().getBegin(),
+             diag::err_using_decl_nested_name_specifier_is_not_base_class)
+          << SS.getScopeRep()
+          << cast<CXXRecordDecl>(CurContext)
+          << SS.getRange();
+      }
       return true;
     }
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to