[clang] [Clang] prevent recovery call expression from proceeding with explicit attributes and undeclared templates (PR #107786)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 25 06:29:09 PDT 2024


================
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 %s
+
+namespace GH49093 {
+  class B {
+  public:
+    static int a() { return 0; } // expected-note {{member is declared here}}
+    decltype(a< 0 >(0)) test;    // expected-error {{member 'a' used before its declaration}}
----------------
erichkeane wrote:

I'm not explicitly saying that (hah!).  But the behavior you have here is not correct.  First, I still don't see why it would say 'used before its declaration', when its declaration is right above it.  Second, SHOULD say something like, "non template used with template args, what are you doing?" sorta error.  

As far as recovery, it could/should probably treat it as if you HADN'T used the template arguments and continue, so any recovery (for the type reference?) should be based on the found-but-not-template type.

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


More information about the cfe-commits mailing list