[clang] [clang] Add missing VisitAtomicTypeLoc to TypeLoc.cpp GetContainedAutoTypeLocVisitor (PR #211752)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Jul 26 08:44:24 PDT 2026
https://github.com/rdevshp updated https://github.com/llvm/llvm-project/pull/211752
>From acc960749e74123ad87b378b35b984c210827b6c Mon Sep 17 00:00:00 2001
From: rdevshp <rdevshp at gmail.com>
Date: Fri, 24 Jul 2026 08:31:26 +0000
Subject: [PATCH 1/2] [clang] Add missing VisitAtomicTypeLoc to TypeLoc.cpp
GetContainedAutoTypeLocVisitor
Fixes #211556 ICE.
Assisted-by: Codex
---
clang/lib/AST/TypeLoc.cpp | 4 ++++
clang/test/SemaCXX/atomic-auto.cpp | 8 ++++++++
2 files changed, 12 insertions(+)
create mode 100644 clang/test/SemaCXX/atomic-auto.cpp
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<>'}}
+};
>From e9c98285c5c8337aafc69ad397b216ef2bcf0866 Mon Sep 17 00:00:00 2001
From: rdevshp <rdevshp at gmail.com>
Date: Sun, 26 Jul 2026 15:43:22 +0000
Subject: [PATCH 2/2] remove -pedantic from atomic-auto.cpp
---
clang/test/SemaCXX/atomic-auto.cpp | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/clang/test/SemaCXX/atomic-auto.cpp b/clang/test/SemaCXX/atomic-auto.cpp
index 9ee833a7c2a0c..476c3715ed418 100644
--- a/clang/test/SemaCXX/atomic-auto.cpp
+++ b/clang/test/SemaCXX/atomic-auto.cpp
@@ -1,8 +1,7 @@
-// RUN: %clang_cc1 -verify -pedantic %s -std=c++20
+// RUN: %clang_cc1 -verify %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<>'}}
+ _Atomic C<> auto &foo = 42; // expected-error {{deduced type 'int' does not satisfy 'C<>'}}
};
More information about the cfe-commits
mailing list