llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Aric Maji (Adam-Warlock09)

<details>
<summary>Changes</summary>

This adds the missing regression test for GH138098.

As noted by @<!-- -->shafik, the crash described in this issue was 
inadvertently fixed by #<!-- -->143423 (which removed delayed typo 
expressions), but the codebase lacked a specific regression test to ensure this 
ICE (Internal Compiler Error) does not return in the future.

This test verifies that Clang correctly emits diagnostics for invalid dependent 
names instead of crashing. 

(I verified on Compiler Explorer that this test successfully crashes on older 
versions of Clang like 17.0.1 up until 20.1.x, and passes on the current `main` 
branch [From 21.1x onward]).

Fixes #<!-- -->138098

---
Full diff: https://github.com/llvm/llvm-project/pull/235483.diff


1 Files Affected:

- (added) clang/test/SemaCXX/gh138098.cpp (+20) 


``````````diff
diff --git a/clang/test/SemaCXX/gh138098.cpp b/clang/test/SemaCXX/gh138098.cpp
new file mode 100644
index 00000000000000..e06ecc1817a837
--- /dev/null
+++ b/clang/test/SemaCXX/gh138098.cpp
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify %s
+
+template<typename T> struct Derived {
+    void f(int index) {
+        // expected-error@+3 {{explicit qualification required to use member 
'type_c' from dependent base class}}
+        // expected-error@+2 {{comparison between pointer and integer ('int' 
and 'auto &(*)()')}}
+        // expected-note@8 {{in instantiation of member function 
'Derived<int>::type_c' requested here}}
+        if (index != type_c<T>) {}
+    }
+    // expected-error@+2 {{cannot deduce return type 'auto &' for function 
with no return statements}}
+    // expected-note@12 {{member is declared here}}
+    static auto& type_c() { }
+};
+
+int main() {
+    Derived<int> d;
+    // expected-note@19 {{in instantiation of member function 
'Derived<int>::f' requested here}}
+    // expected-note@19 {{in instantiation of member function 
'Derived<int>::f' requested here}}
+    d.f(0);
+}

``````````

</details>


https://github.com/llvm/llvm-project/pull/235483
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to