[clang] 4777eb2 - [Sema] Add test for new errors due to 09f8315bba391

Sam McCall via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 18 13:18:41 PST 2022


Author: Sam McCall
Date: 2022-01-18T22:18:35+01:00
New Revision: 4777eb2954080864bcf9dfca0e828c637268eb13

URL: https://github.com/llvm/llvm-project/commit/4777eb2954080864bcf9dfca0e828c637268eb13
DIFF: https://github.com/llvm/llvm-project/commit/4777eb2954080864bcf9dfca0e828c637268eb13.diff

LOG: [Sema] Add test for new errors due to 09f8315bba391

Knowing the type of more dependent expressions means we can diagnose
more errors at template parsing rather than instantiation time.

Such templates are IFNDR, so this is a QoI improvement.
I hadn't anticipated this in the original patch, so had no test.

Added: 
    

Modified: 
    clang/test/SemaTemplate/fun-template-def.cpp

Removed: 
    


################################################################################
diff  --git a/clang/test/SemaTemplate/fun-template-def.cpp b/clang/test/SemaTemplate/fun-template-def.cpp
index 037747d35c0de..de77901b5b601 100644
--- a/clang/test/SemaTemplate/fun-template-def.cpp
+++ b/clang/test/SemaTemplate/fun-template-def.cpp
@@ -21,7 +21,7 @@ int f0(T x) {
 }
 
 template <typename T, typename U>
-T f1(T t1, U u1, int i1)
+T f1(T t1, U u1, int i1, T** tpp)
 {
   T t2 = i1;
   t2 = i1 + u1;
@@ -48,6 +48,7 @@ T f1(T t1, U u1, int i1)
   dummy d2 = offsetof(T, foo); // expected-error {{no viable conversion}}
   dummy d3 = __alignof(u1); // expected-error {{no viable conversion}}
   i1 = typeid(t1); // expected-error {{assigning to 'int' from incompatible type 'const std::type_info'}}
+  i1 = tpp[0].size(); // expected-error {{'T *' is not a structure or union}}
 
   return u1;
 }


        


More information about the cfe-commits mailing list