================
@@ -55,15 +55,21 @@ namespace PR11856 {
 
   template<typename T> T *end(T*);
 
-  class X { };
+  struct X { };
+  struct Y {
+    int end;
+  };
   template <typename T>
   void Foo2() {
     T it1;
-    if (it1->end < it1->end) {
-    }
+    if (it1->end < it1->end) { }
 
     X *x;
-    if (x->end < 7) {  // expected-error{{no member named 'end' in 
'PR11856::X'}}
-    }
+    if (x->end < 7) { } // expected-error{{expected '>'}}
+                        // expected-note@-1{{to match this '<'}}
+                        // expected-error@-2{{expected unqualified-id}}
----------------
mizvekov wrote:

I see.

Still, error recovery is not great here.

I think this looks sufficiently different from a template argument list that we 
should just error out and commit to the interpretation that this is a 
comparison.

We already have this capability to look ahead and tell if something looks like 
a template argument list, see: 
https://github.com/llvm/llvm-project/blob/d07362f7a9fc06e2445f5c4bc62c10a339bf68a5/clang/include/clang/Parse/Parser.h#L2734

https://github.com/llvm/llvm-project/pull/92957
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to