[clang] [clang] Add missing VisitAtomicTypeLoc to TypeLoc.cpp GetContainedAutoTypeLocVisitor (PR #211752)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 24 02:17:20 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: rdevshp (rdevshp)
<details>
<summary>Changes</summary>
This PR adds the missing VisitAtomicTypeLoc method to TypeLoc.cpp GetContainedAutoTypeLocVisitor.
Fixes #<!-- -->211556 ICE.
Assisted-by: Codex
---
Full diff: https://github.com/llvm/llvm-project/pull/211752.diff
2 Files Affected:
- (modified) clang/lib/AST/TypeLoc.cpp (+4)
- (added) clang/test/SemaCXX/atomic-auto.cpp (+8)
``````````diff
diff --git a/clang/lib/AST/TypeLoc.cpp b/clang/lib/AST/TypeLoc.cpp
index 7e72a85136966..d2f7b81d3ef6f 100644
--- a/clang/lib/AST/TypeLoc.cpp
+++ b/clang/lib/AST/TypeLoc.cpp
@@ -817,6 +817,10 @@ namespace {
// Only these types can contain the desired 'auto' type.
+ TypeLoc VisitAtomicTypeLoc(AtomicTypeLoc T) {
+ return Visit(T.getValueLoc());
+ }
+
TypeLoc VisitQualifiedTypeLoc(QualifiedTypeLoc T) {
return Visit(T.getUnqualifiedLoc());
}
diff --git a/clang/test/SemaCXX/atomic-auto.cpp b/clang/test/SemaCXX/atomic-auto.cpp
new file mode 100644
index 0000000000000..9ee833a7c2a0c
--- /dev/null
+++ b/clang/test/SemaCXX/atomic-auto.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -verify -pedantic %s -std=c++20
+
+template<typename T> concept C = false; // expected-note {{because 'false' evaluated to false}}
+
+void test() {
+ _Atomic C<> auto &foo = 42; // expected-warning {{'_Atomic' is a C11 extension}} \
+ // expected-error {{deduced type 'int' does not satisfy 'C<>'}}
+};
``````````
</details>
https://github.com/llvm/llvm-project/pull/211752
More information about the cfe-commits
mailing list