[PATCH] D82099: [AST][RecoveryAST] Populate error-bit from Type to Expr.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 18 08:07:06 PDT 2020


hokein created this revision.
hokein added a reviewer: sammccall.
Herald added a project: clang.

Looks like this is a fallout when we introduce the error-bit in Type.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82099

Files:
  clang/include/clang/AST/DependenceFlags.h
  clang/test/SemaCXX/invalid-template-base-specifier.cpp


Index: clang/test/SemaCXX/invalid-template-base-specifier.cpp
===================================================================
--- clang/test/SemaCXX/invalid-template-base-specifier.cpp
+++ clang/test/SemaCXX/invalid-template-base-specifier.cpp
@@ -1,6 +1,7 @@
 // RUN: %clang_cc1 -frecovery-ast -verify %s
 
-bool Foo(int *); // expected-note {{candidate function not viable}}
+bool Foo(int *); // expected-note {{candidate function not viable}} \
+                 // expected-note {{candidate function not viable}}
 
 template <typename T>
 struct Crash : decltype(Foo(T())) { // expected-error {{no matching function for call to 'Foo'}}
@@ -8,3 +9,12 @@
 };
 
 void test() { Crash<int>(); } // expected-note {{in instantiation of template class}}
+
+template <typename T>
+using Alias = decltype(Foo(T())); // expected-error {{no matching function for call to 'Foo'}}
+template <typename T>
+struct Crash2 : decltype(Alias<T>()) { // expected-note {{in instantiation of template type alias 'Alias' requested here}}
+  Crash2(){};
+};
+
+void test2() { Crash2<int>(); } // expected-note {{in instantiation of template class 'Crash2<int>' requested here}}
Index: clang/include/clang/AST/DependenceFlags.h
===================================================================
--- clang/include/clang/AST/DependenceFlags.h
+++ clang/include/clang/AST/DependenceFlags.h
@@ -118,10 +118,10 @@
 
   Dependence(TypeDependence D)
       : V(translate(D, TypeDependence::UnexpandedPack, UnexpandedPack) |
-             translate(D, TypeDependence::Instantiation, Instantiation) |
-             translate(D, TypeDependence::Dependent, Dependent) |
-             translate(D, TypeDependence::VariablyModified, VariablyModified)) {
-  }
+          translate(D, TypeDependence::Instantiation, Instantiation) |
+          translate(D, TypeDependence::Dependent, Dependent) |
+          translate(D, TypeDependence::Error, Error) |
+          translate(D, TypeDependence::VariablyModified, VariablyModified)) {}
 
   Dependence(ExprDependence D)
       : V(translate(D, ExprDependence::UnexpandedPack, UnexpandedPack) |


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82099.271719.patch
Type: text/x-patch
Size: 2109 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200618/2bee6abc/attachment.bin>


More information about the cfe-commits mailing list