[clang] [clang] Reject __super when preceded by a scope specifier (PR #221492)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 7 22:27:11 PDT 2026


================
@@ -21,6 +21,13 @@ struct Base1 {
   typedef int XXX;
 };
 
+struct InvalidGlobalQualifier : Base1 {
+  // A parser that drops the global qualifier is left with the valid
+  // declaration `__super::XXX x;` and accepts this line silently; expecting
+  // a diagnostic here catches that even in builds without assertions.
+  ::__super::XXX x; // expected-error {{expected unqualified-id}}
----------------
shafik wrote:

I would have liked to see more test cases like:

```cpp
struct SS : S  {
  using ::__super::;
  void f(::__super::);
};
```

or 

```cpp
struct S {};
struct SS : __super::S  {};
```

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


More information about the cfe-commits mailing list