Skip to content

Conversation

zyn0217
Copy link
Contributor

@zyn0217 zyn0217 commented Oct 11, 2025

Using the canonical form of SugarConverted was an oversight during the iteration of e9972de. We now retain sugar for better diagnostics.

Using the canonical form of SugarConverted was an oversight during the
iteration of e9972de. We now retain sugar for better diagnostics.
@zyn0217 zyn0217 requested review from cor3ntin and mizvekov October 11, 2025 10:56
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" HLSL HLSL Language Support labels Oct 11, 2025
@llvmbot
Copy link
Member

llvmbot commented Oct 11, 2025

@llvm/pr-subscribers-clang

Author: Younan Zhang (zyn0217)

Changes

Using the canonical form of SugarConverted was an oversight during the iteration of e9972de. We now retain sugar for better diagnostics.


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

8 Files Affected:

  • (modified) clang/lib/Sema/SemaConcept.cpp (+1-2)
  • (modified) clang/test/CXX/expr/expr.prim/expr.prim.req/compound-requirement.cpp (+2-2)
  • (modified) clang/test/CXX/expr/expr.prim/expr.prim.req/nested-requirement.cpp (+1-1)
  • (modified) clang/test/CXX/temp/temp.param/p10-2a.cpp (+2-2)
  • (modified) clang/test/SemaHLSL/BuiltIns/Buffers.hlsl (+3-3)
  • (modified) clang/test/SemaHLSL/BuiltIns/RWBuffers.hlsl (+3-3)
  • (modified) clang/test/SemaTemplate/concepts-recursive-inst.cpp (+2-2)
  • (modified) clang/test/SemaTemplate/concepts.cpp (+4-4)
diff --git a/clang/lib/Sema/SemaConcept.cpp b/clang/lib/Sema/SemaConcept.cpp
index 9cbd1bd772f6f..7c44efd7b9c1c 100644
--- a/clang/lib/Sema/SemaConcept.cpp
+++ b/clang/lib/Sema/SemaConcept.cpp
@@ -614,8 +614,7 @@ ConstraintSatisfactionChecker::SubstitutionInTemplateArguments(
   for (unsigned I = 0, MappedIndex = 0; I < Used.size(); I++) {
     TemplateArgument Arg;
     if (Used[I])
-      Arg = S.Context.getCanonicalTemplateArgument(
-          CTAI.SugaredConverted[MappedIndex++]);
+      Arg = CTAI.SugaredConverted[MappedIndex++];
     if (I < SubstitutedOuterMost.size()) {
       SubstitutedOuterMost[I] = Arg;
       Offset = I + 1;
diff --git a/clang/test/CXX/expr/expr.prim/expr.prim.req/compound-requirement.cpp b/clang/test/CXX/expr/expr.prim/expr.prim.req/compound-requirement.cpp
index af2dce81d8a4b..5f1243a654f54 100644
--- a/clang/test/CXX/expr/expr.prim/expr.prim.req/compound-requirement.cpp
+++ b/clang/test/CXX/expr/expr.prim/expr.prim.req/compound-requirement.cpp
@@ -149,7 +149,7 @@ namespace std_example {
   template<typename T> constexpr bool is_same_v<T, T> = true;
 
   template<typename T, typename U> concept same_as = is_same_v<T, U>;
-  // expected-note@-1 {{because 'is_same_v<int, typename std_example::T2::inner>' evaluated to false}}
+  // expected-note@-1 {{because 'is_same_v<int, typename T2::inner>' evaluated to false}}
 
   static_assert(C1<int>);
   static_assert(C1<int*>);
@@ -160,7 +160,7 @@ namespace std_example {
   template<typename T> concept C2 =
     requires(T x) {
       {*x} -> same_as<typename T::inner>;
-      // expected-note@-1{{because 'same_as<int, typename std_example::T2::inner>' evaluated to false}}
+      // expected-note@-1{{because 'same_as<int, typename T2::inner>' evaluated to false}}
       // expected-note@-2{{because '*x' would be invalid: indirection requires pointer operand ('int' invalid)}}
     };
 
diff --git a/clang/test/CXX/expr/expr.prim/expr.prim.req/nested-requirement.cpp b/clang/test/CXX/expr/expr.prim/expr.prim.req/nested-requirement.cpp
index 70a96bed05867..9fc4906459373 100644
--- a/clang/test/CXX/expr/expr.prim/expr.prim.req/nested-requirement.cpp
+++ b/clang/test/CXX/expr/expr.prim/expr.prim.req/nested-requirement.cpp
@@ -27,7 +27,7 @@ using r4i = X<void>::r4<int>; // expected-error{{constraints not satisfied for c
 
 // C++ [expr.prim.req.nested] Examples
 namespace std_example {
-  template<typename U> concept C1 = sizeof(U) == 1; // expected-note{{because 'sizeof(int) == 1' (4 == 1) evaluated to false}}
+  template<typename U> concept C1 = sizeof(U) == 1; // expected-note{{because 'sizeof(decltype(+t)) == 1' (4 == 1) evaluated to false}}
   template<typename T> concept D =
     requires (T t) {
       requires C1<decltype (+t)>; // expected-note{{because 'decltype(+t)' (aka 'int') does not satisfy 'C1'}}
diff --git a/clang/test/CXX/temp/temp.param/p10-2a.cpp b/clang/test/CXX/temp/temp.param/p10-2a.cpp
index c0406f88db5f3..4f192d33ebe7e 100644
--- a/clang/test/CXX/temp/temp.param/p10-2a.cpp
+++ b/clang/test/CXX/temp/temp.param/p10-2a.cpp
@@ -95,8 +95,8 @@ concept OneOf = (is_same_v<T, Ts> || ...); // #OneOf
 // expected-note@#OneOf 3{{because 'is_same_v<int, char[1]>' evaluated to false}}
 // expected-note@#OneOf 3{{and 'is_same_v<int, char[2]>' evaluated to false}}
 // expected-note@#OneOf {{because 'is_same_v<decltype(nullptr), char>' evaluated to false}}
-// expected-note@#OneOf {{because 'is_same_v<std::nullptr_t, char>' evaluated to false}}
-// expected-note@#OneOf {{and 'is_same_v<std::nullptr_t, int>' evaluated to false}}
+// expected-note@#OneOf {{because 'is_same_v<decltype(nullptr), char>' evaluated to false}}
+// expected-note@#OneOf {{and 'is_same_v<decltype(nullptr), int>' evaluated to false}}
 // expected-note@#OneOf {{and 'is_same_v<decltype(nullptr), int>' evaluated to false}}
 
 template<OneOf<char[1], char[2]> T, OneOf<int, long, char> U>
diff --git a/clang/test/SemaHLSL/BuiltIns/Buffers.hlsl b/clang/test/SemaHLSL/BuiltIns/Buffers.hlsl
index 999372c95554e..3f0a37d5d5a08 100644
--- a/clang/test/SemaHLSL/BuiltIns/Buffers.hlsl
+++ b/clang/test/SemaHLSL/BuiltIns/Buffers.hlsl
@@ -20,7 +20,7 @@ Buffer<double2> r4;
 // expected-error@+4 {{constraints not satisfied for class template 'Buffer'}}
 // expected-note@*:* {{template declaration from hidden source: template <typename element_type> requires __is_typed_resource_element_compatible<element_type> class Buffer}}
 // expected-note@*:* {{because 'Buffer<int>' does not satisfy '__is_typed_resource_element_compatible'}}
-// expected-note@*:* {{because '__builtin_hlsl_is_typed_resource_element_compatible(hlsl::Buffer<int>)' evaluated to false}}
+// expected-note@*:* {{because '__builtin_hlsl_is_typed_resource_element_compatible(Buffer<int>)' evaluated to false}}
 Buffer<Buffer<int> > r5;
 
 struct s {
@@ -66,7 +66,7 @@ Buffer<half[4]> r10;
 typedef vector<int, 8> int8;
 // expected-error@+3 {{constraints not satisfied for class template 'Buffer'}}
 // expected-note@*:* {{because 'int8' (aka 'vector<int, 8>') does not satisfy '__is_typed_resource_element_compatible'}}
-// expected-note@*:* {{because '__builtin_hlsl_is_typed_resource_element_compatible(vector<int, 8>)' evaluated to false}}
+// expected-note@*:* {{because '__builtin_hlsl_is_typed_resource_element_compatible(int8)' evaluated to false}}
 Buffer<int8> r11;
 
 typedef int MyInt;
@@ -91,7 +91,7 @@ Buffer<numbers> r15;
 
 // expected-error@+3 {{constraints not satisfied for class template 'Buffer'}}
 // expected-note@*:* {{because 'double3' (aka 'vector<double, 3>') does not satisfy '__is_typed_resource_element_compatible'}}
-// expected-note@*:* {{because '__builtin_hlsl_is_typed_resource_element_compatible(vector<double, 3>)' evaluated to false}}
+// expected-note@*:* {{because '__builtin_hlsl_is_typed_resource_element_compatible(double3)' evaluated to false}}
 Buffer<double3> r16;
 
 
diff --git a/clang/test/SemaHLSL/BuiltIns/RWBuffers.hlsl b/clang/test/SemaHLSL/BuiltIns/RWBuffers.hlsl
index b33f2af8a1117..aa36c4838273e 100644
--- a/clang/test/SemaHLSL/BuiltIns/RWBuffers.hlsl
+++ b/clang/test/SemaHLSL/BuiltIns/RWBuffers.hlsl
@@ -20,7 +20,7 @@ RWBuffer<double2> r4;
 // expected-error@+4 {{constraints not satisfied for class template 'RWBuffer'}}
 // expected-note@*:* {{template declaration from hidden source: template <typename element_type> requires __is_typed_resource_element_compatible<element_type> class RWBuffer}}
 // expected-note@*:* {{because 'RWBuffer<int>' does not satisfy '__is_typed_resource_element_compatible'}}
-// expected-note@*:* {{because '__builtin_hlsl_is_typed_resource_element_compatible(hlsl::RWBuffer<int>)' evaluated to false}}
+// expected-note@*:* {{because '__builtin_hlsl_is_typed_resource_element_compatible(RWBuffer<int>)' evaluated to false}}
 RWBuffer<RWBuffer<int> > r5;
 
 struct s {
@@ -66,7 +66,7 @@ RWBuffer<half[4]> r10;
 typedef vector<int, 8> int8;
 // expected-error@+3 {{constraints not satisfied for class template 'RWBuffer'}}
 // expected-note@*:* {{because 'int8' (aka 'vector<int, 8>') does not satisfy '__is_typed_resource_element_compatible'}}
-// expected-note@*:* {{because '__builtin_hlsl_is_typed_resource_element_compatible(vector<int, 8>)' evaluated to false}}
+// expected-note@*:* {{because '__builtin_hlsl_is_typed_resource_element_compatible(int8)' evaluated to false}}
 RWBuffer<int8> r11;
 
 typedef int MyInt;
@@ -91,7 +91,7 @@ RWBuffer<numbers> r15;
 
 // expected-error@+3 {{constraints not satisfied for class template 'RWBuffer'}}
 // expected-note@*:* {{because 'double3' (aka 'vector<double, 3>') does not satisfy '__is_typed_resource_element_compatible'}}
-// expected-note@*:* {{because '__builtin_hlsl_is_typed_resource_element_compatible(vector<double, 3>)' evaluated to false}}
+// expected-note@*:* {{because '__builtin_hlsl_is_typed_resource_element_compatible(double3)' evaluated to false}}
 RWBuffer<double3> r16;
 
 
diff --git a/clang/test/SemaTemplate/concepts-recursive-inst.cpp b/clang/test/SemaTemplate/concepts-recursive-inst.cpp
index 73dce9317f383..d36c6a8f02b20 100644
--- a/clang/test/SemaTemplate/concepts-recursive-inst.cpp
+++ b/clang/test/SemaTemplate/concepts-recursive-inst.cpp
@@ -68,8 +68,8 @@ struct my_range{
 void baz() {
 auto it = begin(rng); // #BEGIN_CALL
 // expected-error-re@#INF_REQ {{satisfaction of constraint {{.*}} depends on itself}}
-// expected-note@#INF_BEGIN {{while checking the satisfaction of concept 'Inf<DirectRecursiveCheck::my_range>' requested here}}
-// expected-note@#INF_BEGIN_EXPR {{while checking constraint satisfaction for template 'begin<DirectRecursiveCheck::my_range>' required here}}
+// expected-note@#INF_BEGIN {{while checking the satisfaction of concept 'Inf<struct my_range>' requested here}}
+// expected-note@#INF_BEGIN_EXPR {{while checking constraint satisfaction for template 'begin<struct my_range>' required here}}
 // expected-note@#INF_BEGIN_EXPR {{while substituting deduced template arguments into function template 'begin'}}
 // expected-note@#INF_BEGIN_EXPR {{in instantiation of requirement here}}
 // expected-note@#INF_REQ {{while substituting template arguments into constraint expression here}}
diff --git a/clang/test/SemaTemplate/concepts.cpp b/clang/test/SemaTemplate/concepts.cpp
index 3fbe7c0ac650f..ee2bb8de66079 100644
--- a/clang/test/SemaTemplate/concepts.cpp
+++ b/clang/test/SemaTemplate/concepts.cpp
@@ -833,13 +833,13 @@ struct Parent {
 static_assert(Parent<void>::TakesUnary<int, 0>::i == 0);
 // expected-error@+3{{constraints not satisfied for class template 'TakesUnary'}}
 // expected-note@#UNARY{{because 'decltype(0ULL)' (aka 'unsigned long long') does not satisfy 'C'}}
-// expected-note@#61777_C{{because 'sizeof(unsigned long long) == 4' (8 == 4) evaluated to false}}
+// expected-note@#61777_C{{because 'sizeof(decltype(0ULL)) == 4' (8 == 4) evaluated to false}}
 static_assert(Parent<void>::TakesUnary<int, 0uLL>::i == 0);
 
 static_assert(Parent<int>::TakesBinary<int, 0>::i == 0);
 // expected-error@+3{{constraints not satisfied for class template 'TakesBinary'}}
 // expected-note@#BINARY{{because 'C2<decltype(0ULL), int>' evaluated to false}}
-// expected-note@#61777_C2{{because 'sizeof(unsigned long long) == sizeof(int)' (8 == 4) evaluated to false}}
+// expected-note@#61777_C2{{because 'sizeof(decltype(0ULL)) == sizeof(int)' (8 == 4) evaluated to false}}
 static_assert(Parent<int>::TakesBinary<int, 0ULL>::i == 0);
 }
 
@@ -1329,8 +1329,8 @@ static_assert(__cpp17_iterator<not_move_constructible>); \
 // expected-error {{static assertion failed}} \
 // expected-note {{because 'not_move_constructible' does not satisfy '__cpp17_iterator'}} \
 // expected-note@#__cpp17_copy_constructible {{because 'not_move_constructible' does not satisfy '__cpp17_copy_constructible'}} \
-// expected-note@#__cpp17_move_constructible {{because 'parameter_mapping_regressions::case3::not_move_constructible' does not satisfy '__cpp17_move_constructible'}} \
-// expected-note@#is_move_constructible_v {{because 'is_move_constructible_v<parameter_mapping_regressions::case3::not_move_constructible>' evaluated to false}}
+// expected-note@#__cpp17_move_constructible {{because 'not_move_constructible' does not satisfy '__cpp17_move_constructible'}} \
+// expected-note@#is_move_constructible_v {{because 'is_move_constructible_v<not_move_constructible>' evaluated to false}}
 }
 
 namespace case4 {

@llvmbot
Copy link
Member

llvmbot commented Oct 11, 2025

@llvm/pr-subscribers-hlsl

Author: Younan Zhang (zyn0217)

Changes

Using the canonical form of SugarConverted was an oversight during the iteration of e9972de. We now retain sugar for better diagnostics.


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

8 Files Affected:

  • (modified) clang/lib/Sema/SemaConcept.cpp (+1-2)
  • (modified) clang/test/CXX/expr/expr.prim/expr.prim.req/compound-requirement.cpp (+2-2)
  • (modified) clang/test/CXX/expr/expr.prim/expr.prim.req/nested-requirement.cpp (+1-1)
  • (modified) clang/test/CXX/temp/temp.param/p10-2a.cpp (+2-2)
  • (modified) clang/test/SemaHLSL/BuiltIns/Buffers.hlsl (+3-3)
  • (modified) clang/test/SemaHLSL/BuiltIns/RWBuffers.hlsl (+3-3)
  • (modified) clang/test/SemaTemplate/concepts-recursive-inst.cpp (+2-2)
  • (modified) clang/test/SemaTemplate/concepts.cpp (+4-4)
diff --git a/clang/lib/Sema/SemaConcept.cpp b/clang/lib/Sema/SemaConcept.cpp
index 9cbd1bd772f6f..7c44efd7b9c1c 100644
--- a/clang/lib/Sema/SemaConcept.cpp
+++ b/clang/lib/Sema/SemaConcept.cpp
@@ -614,8 +614,7 @@ ConstraintSatisfactionChecker::SubstitutionInTemplateArguments(
   for (unsigned I = 0, MappedIndex = 0; I < Used.size(); I++) {
     TemplateArgument Arg;
     if (Used[I])
-      Arg = S.Context.getCanonicalTemplateArgument(
-          CTAI.SugaredConverted[MappedIndex++]);
+      Arg = CTAI.SugaredConverted[MappedIndex++];
     if (I < SubstitutedOuterMost.size()) {
       SubstitutedOuterMost[I] = Arg;
       Offset = I + 1;
diff --git a/clang/test/CXX/expr/expr.prim/expr.prim.req/compound-requirement.cpp b/clang/test/CXX/expr/expr.prim/expr.prim.req/compound-requirement.cpp
index af2dce81d8a4b..5f1243a654f54 100644
--- a/clang/test/CXX/expr/expr.prim/expr.prim.req/compound-requirement.cpp
+++ b/clang/test/CXX/expr/expr.prim/expr.prim.req/compound-requirement.cpp
@@ -149,7 +149,7 @@ namespace std_example {
   template<typename T> constexpr bool is_same_v<T, T> = true;
 
   template<typename T, typename U> concept same_as = is_same_v<T, U>;
-  // expected-note@-1 {{because 'is_same_v<int, typename std_example::T2::inner>' evaluated to false}}
+  // expected-note@-1 {{because 'is_same_v<int, typename T2::inner>' evaluated to false}}
 
   static_assert(C1<int>);
   static_assert(C1<int*>);
@@ -160,7 +160,7 @@ namespace std_example {
   template<typename T> concept C2 =
     requires(T x) {
       {*x} -> same_as<typename T::inner>;
-      // expected-note@-1{{because 'same_as<int, typename std_example::T2::inner>' evaluated to false}}
+      // expected-note@-1{{because 'same_as<int, typename T2::inner>' evaluated to false}}
       // expected-note@-2{{because '*x' would be invalid: indirection requires pointer operand ('int' invalid)}}
     };
 
diff --git a/clang/test/CXX/expr/expr.prim/expr.prim.req/nested-requirement.cpp b/clang/test/CXX/expr/expr.prim/expr.prim.req/nested-requirement.cpp
index 70a96bed05867..9fc4906459373 100644
--- a/clang/test/CXX/expr/expr.prim/expr.prim.req/nested-requirement.cpp
+++ b/clang/test/CXX/expr/expr.prim/expr.prim.req/nested-requirement.cpp
@@ -27,7 +27,7 @@ using r4i = X<void>::r4<int>; // expected-error{{constraints not satisfied for c
 
 // C++ [expr.prim.req.nested] Examples
 namespace std_example {
-  template<typename U> concept C1 = sizeof(U) == 1; // expected-note{{because 'sizeof(int) == 1' (4 == 1) evaluated to false}}
+  template<typename U> concept C1 = sizeof(U) == 1; // expected-note{{because 'sizeof(decltype(+t)) == 1' (4 == 1) evaluated to false}}
   template<typename T> concept D =
     requires (T t) {
       requires C1<decltype (+t)>; // expected-note{{because 'decltype(+t)' (aka 'int') does not satisfy 'C1'}}
diff --git a/clang/test/CXX/temp/temp.param/p10-2a.cpp b/clang/test/CXX/temp/temp.param/p10-2a.cpp
index c0406f88db5f3..4f192d33ebe7e 100644
--- a/clang/test/CXX/temp/temp.param/p10-2a.cpp
+++ b/clang/test/CXX/temp/temp.param/p10-2a.cpp
@@ -95,8 +95,8 @@ concept OneOf = (is_same_v<T, Ts> || ...); // #OneOf
 // expected-note@#OneOf 3{{because 'is_same_v<int, char[1]>' evaluated to false}}
 // expected-note@#OneOf 3{{and 'is_same_v<int, char[2]>' evaluated to false}}
 // expected-note@#OneOf {{because 'is_same_v<decltype(nullptr), char>' evaluated to false}}
-// expected-note@#OneOf {{because 'is_same_v<std::nullptr_t, char>' evaluated to false}}
-// expected-note@#OneOf {{and 'is_same_v<std::nullptr_t, int>' evaluated to false}}
+// expected-note@#OneOf {{because 'is_same_v<decltype(nullptr), char>' evaluated to false}}
+// expected-note@#OneOf {{and 'is_same_v<decltype(nullptr), int>' evaluated to false}}
 // expected-note@#OneOf {{and 'is_same_v<decltype(nullptr), int>' evaluated to false}}
 
 template<OneOf<char[1], char[2]> T, OneOf<int, long, char> U>
diff --git a/clang/test/SemaHLSL/BuiltIns/Buffers.hlsl b/clang/test/SemaHLSL/BuiltIns/Buffers.hlsl
index 999372c95554e..3f0a37d5d5a08 100644
--- a/clang/test/SemaHLSL/BuiltIns/Buffers.hlsl
+++ b/clang/test/SemaHLSL/BuiltIns/Buffers.hlsl
@@ -20,7 +20,7 @@ Buffer<double2> r4;
 // expected-error@+4 {{constraints not satisfied for class template 'Buffer'}}
 // expected-note@*:* {{template declaration from hidden source: template <typename element_type> requires __is_typed_resource_element_compatible<element_type> class Buffer}}
 // expected-note@*:* {{because 'Buffer<int>' does not satisfy '__is_typed_resource_element_compatible'}}
-// expected-note@*:* {{because '__builtin_hlsl_is_typed_resource_element_compatible(hlsl::Buffer<int>)' evaluated to false}}
+// expected-note@*:* {{because '__builtin_hlsl_is_typed_resource_element_compatible(Buffer<int>)' evaluated to false}}
 Buffer<Buffer<int> > r5;
 
 struct s {
@@ -66,7 +66,7 @@ Buffer<half[4]> r10;
 typedef vector<int, 8> int8;
 // expected-error@+3 {{constraints not satisfied for class template 'Buffer'}}
 // expected-note@*:* {{because 'int8' (aka 'vector<int, 8>') does not satisfy '__is_typed_resource_element_compatible'}}
-// expected-note@*:* {{because '__builtin_hlsl_is_typed_resource_element_compatible(vector<int, 8>)' evaluated to false}}
+// expected-note@*:* {{because '__builtin_hlsl_is_typed_resource_element_compatible(int8)' evaluated to false}}
 Buffer<int8> r11;
 
 typedef int MyInt;
@@ -91,7 +91,7 @@ Buffer<numbers> r15;
 
 // expected-error@+3 {{constraints not satisfied for class template 'Buffer'}}
 // expected-note@*:* {{because 'double3' (aka 'vector<double, 3>') does not satisfy '__is_typed_resource_element_compatible'}}
-// expected-note@*:* {{because '__builtin_hlsl_is_typed_resource_element_compatible(vector<double, 3>)' evaluated to false}}
+// expected-note@*:* {{because '__builtin_hlsl_is_typed_resource_element_compatible(double3)' evaluated to false}}
 Buffer<double3> r16;
 
 
diff --git a/clang/test/SemaHLSL/BuiltIns/RWBuffers.hlsl b/clang/test/SemaHLSL/BuiltIns/RWBuffers.hlsl
index b33f2af8a1117..aa36c4838273e 100644
--- a/clang/test/SemaHLSL/BuiltIns/RWBuffers.hlsl
+++ b/clang/test/SemaHLSL/BuiltIns/RWBuffers.hlsl
@@ -20,7 +20,7 @@ RWBuffer<double2> r4;
 // expected-error@+4 {{constraints not satisfied for class template 'RWBuffer'}}
 // expected-note@*:* {{template declaration from hidden source: template <typename element_type> requires __is_typed_resource_element_compatible<element_type> class RWBuffer}}
 // expected-note@*:* {{because 'RWBuffer<int>' does not satisfy '__is_typed_resource_element_compatible'}}
-// expected-note@*:* {{because '__builtin_hlsl_is_typed_resource_element_compatible(hlsl::RWBuffer<int>)' evaluated to false}}
+// expected-note@*:* {{because '__builtin_hlsl_is_typed_resource_element_compatible(RWBuffer<int>)' evaluated to false}}
 RWBuffer<RWBuffer<int> > r5;
 
 struct s {
@@ -66,7 +66,7 @@ RWBuffer<half[4]> r10;
 typedef vector<int, 8> int8;
 // expected-error@+3 {{constraints not satisfied for class template 'RWBuffer'}}
 // expected-note@*:* {{because 'int8' (aka 'vector<int, 8>') does not satisfy '__is_typed_resource_element_compatible'}}
-// expected-note@*:* {{because '__builtin_hlsl_is_typed_resource_element_compatible(vector<int, 8>)' evaluated to false}}
+// expected-note@*:* {{because '__builtin_hlsl_is_typed_resource_element_compatible(int8)' evaluated to false}}
 RWBuffer<int8> r11;
 
 typedef int MyInt;
@@ -91,7 +91,7 @@ RWBuffer<numbers> r15;
 
 // expected-error@+3 {{constraints not satisfied for class template 'RWBuffer'}}
 // expected-note@*:* {{because 'double3' (aka 'vector<double, 3>') does not satisfy '__is_typed_resource_element_compatible'}}
-// expected-note@*:* {{because '__builtin_hlsl_is_typed_resource_element_compatible(vector<double, 3>)' evaluated to false}}
+// expected-note@*:* {{because '__builtin_hlsl_is_typed_resource_element_compatible(double3)' evaluated to false}}
 RWBuffer<double3> r16;
 
 
diff --git a/clang/test/SemaTemplate/concepts-recursive-inst.cpp b/clang/test/SemaTemplate/concepts-recursive-inst.cpp
index 73dce9317f383..d36c6a8f02b20 100644
--- a/clang/test/SemaTemplate/concepts-recursive-inst.cpp
+++ b/clang/test/SemaTemplate/concepts-recursive-inst.cpp
@@ -68,8 +68,8 @@ struct my_range{
 void baz() {
 auto it = begin(rng); // #BEGIN_CALL
 // expected-error-re@#INF_REQ {{satisfaction of constraint {{.*}} depends on itself}}
-// expected-note@#INF_BEGIN {{while checking the satisfaction of concept 'Inf<DirectRecursiveCheck::my_range>' requested here}}
-// expected-note@#INF_BEGIN_EXPR {{while checking constraint satisfaction for template 'begin<DirectRecursiveCheck::my_range>' required here}}
+// expected-note@#INF_BEGIN {{while checking the satisfaction of concept 'Inf<struct my_range>' requested here}}
+// expected-note@#INF_BEGIN_EXPR {{while checking constraint satisfaction for template 'begin<struct my_range>' required here}}
 // expected-note@#INF_BEGIN_EXPR {{while substituting deduced template arguments into function template 'begin'}}
 // expected-note@#INF_BEGIN_EXPR {{in instantiation of requirement here}}
 // expected-note@#INF_REQ {{while substituting template arguments into constraint expression here}}
diff --git a/clang/test/SemaTemplate/concepts.cpp b/clang/test/SemaTemplate/concepts.cpp
index 3fbe7c0ac650f..ee2bb8de66079 100644
--- a/clang/test/SemaTemplate/concepts.cpp
+++ b/clang/test/SemaTemplate/concepts.cpp
@@ -833,13 +833,13 @@ struct Parent {
 static_assert(Parent<void>::TakesUnary<int, 0>::i == 0);
 // expected-error@+3{{constraints not satisfied for class template 'TakesUnary'}}
 // expected-note@#UNARY{{because 'decltype(0ULL)' (aka 'unsigned long long') does not satisfy 'C'}}
-// expected-note@#61777_C{{because 'sizeof(unsigned long long) == 4' (8 == 4) evaluated to false}}
+// expected-note@#61777_C{{because 'sizeof(decltype(0ULL)) == 4' (8 == 4) evaluated to false}}
 static_assert(Parent<void>::TakesUnary<int, 0uLL>::i == 0);
 
 static_assert(Parent<int>::TakesBinary<int, 0>::i == 0);
 // expected-error@+3{{constraints not satisfied for class template 'TakesBinary'}}
 // expected-note@#BINARY{{because 'C2<decltype(0ULL), int>' evaluated to false}}
-// expected-note@#61777_C2{{because 'sizeof(unsigned long long) == sizeof(int)' (8 == 4) evaluated to false}}
+// expected-note@#61777_C2{{because 'sizeof(decltype(0ULL)) == sizeof(int)' (8 == 4) evaluated to false}}
 static_assert(Parent<int>::TakesBinary<int, 0ULL>::i == 0);
 }
 
@@ -1329,8 +1329,8 @@ static_assert(__cpp17_iterator<not_move_constructible>); \
 // expected-error {{static assertion failed}} \
 // expected-note {{because 'not_move_constructible' does not satisfy '__cpp17_iterator'}} \
 // expected-note@#__cpp17_copy_constructible {{because 'not_move_constructible' does not satisfy '__cpp17_copy_constructible'}} \
-// expected-note@#__cpp17_move_constructible {{because 'parameter_mapping_regressions::case3::not_move_constructible' does not satisfy '__cpp17_move_constructible'}} \
-// expected-note@#is_move_constructible_v {{because 'is_move_constructible_v<parameter_mapping_regressions::case3::not_move_constructible>' evaluated to false}}
+// expected-note@#__cpp17_move_constructible {{because 'not_move_constructible' does not satisfy '__cpp17_move_constructible'}} \
+// expected-note@#is_move_constructible_v {{because 'is_move_constructible_v<not_move_constructible>' evaluated to false}}
 }
 
 namespace case4 {

@zyn0217 zyn0217 merged commit d72cd24 into llvm:main Oct 12, 2025
14 checks passed
@zyn0217 zyn0217 deleted the post-parameter-mapping branch October 12, 2025 16:47
Copy link
Contributor

@mizvekov mizvekov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Can you please add the test case from the report which caused the original PR to be reverted?

DharuniRAcharya pushed a commit to DharuniRAcharya/llvm-project that referenced this pull request Oct 13, 2025
Using the canonical form of SugarConverted was an oversight during the
iteration of e9972de. We now retain sugar for better diagnostics.
@zeroomega
Copy link
Contributor

We noticed a build failure on our code base after this PR was landed (confirmed through bisecting). It looks like after this patch, a pointer to a variable length array is no longer satisfy the constraint of "contiguous_iterator" and will trigger a compiler error. For example

#include <span>

extern void sink(std::span<int>);

void caller(size_t len) {
    int local_array[len];
    sink(std::span<int>(local_array, len));
}

The code above will compile before this patch but will fail with error:
Is it expected?

<source>:6:21: warning: variable length arrays in C++ are a Clang extension [-Wvla-cxx-extension]
    6 |     int local_array[len];
      |                     ^~~
<source>:6:21: note: function parameter 'len' with unknown value cannot be used in a constant expression
<source>:5:20: note: declared here
    5 | void caller(size_t len) {
      |                    ^
<source>:7:10: error: no matching constructor for initialization of 'std::span<int>'
    7 |     sink(std::span<int>(local_array, len));
      |          ^              ~~~~~~~~~~~~~~~~
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/span:448:35: note: candidate template ignored: constraints not satisfied [with _It = int *]
  448 |   _LIBCPP_HIDE_FROM_ABI constexpr span(_It __first, size_type __count)
      |                                   ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/span:447:13: note: because '__span_compatible_iterator<int *, element_type>' evaluated to false
  447 |   template <__span_compatible_iterator<element_type> _It>
      |             ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/span:226:5: note: because 'int *' does not satisfy 'contiguous_iterator'
  226 |     contiguous_iterator<_It> && __span_array_convertible<remove_reference_t<iter_reference_t<_It>>, _Tp>;
      |     ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:235:5: note: because 'int *' does not satisfy 'random_access_iterator'
  235 |     random_access_iterator<_Ip> && derived_from<_ITER_CONCEPT<_Ip>, contiguous_iterator_tag> &&
      |     ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:222:5: note: because 'int *' does not satisfy 'bidirectional_iterator'
  222 |     bidirectional_iterator<_Ip> && derived_from<_ITER_CONCEPT<_Ip>, random_access_iterator_tag> &&
      |     ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:215:5: note: because 'int *' does not satisfy 'forward_iterator'
  215 |     forward_iterator<_Ip> && derived_from<_ITER_CONCEPT<_Ip>, bidirectional_iterator_tag> && requires(_Ip __i) {
      |     ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:209:5: note: because 'int *' does not satisfy 'input_iterator'
  209 |     input_iterator<_Ip> && derived_from<_ITER_CONCEPT<_Ip>, forward_iterator_tag> && incrementable<_Ip> &&
      |     ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:195:26: note: because 'int *' does not satisfy 'input_or_output_iterator'
  195 | concept input_iterator = input_or_output_iterator<_Ip> && indirectly_readable<_Ip> && requires {
      |                          ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:140:6: note: because 'int *' does not satisfy 'weakly_incrementable'
  140 | } && weakly_incrementable<_Ip>;
      |      ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:123:5: note: because 'int *' does not satisfy 'movable'
  123 |     movable<_Ip> && requires(_Ip __i) {
      |     ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__concepts/movable.h:29:66: note: because 'assignable_from<int *&, int *>' evaluated to false
   29 | concept movable = is_object_v<_Tp> && move_constructible<_Tp> && assignable_from<_Tp&, _Tp> && swappable<_Tp>;
      |                                                                  ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__concepts/assignable.h:34:48: note: because 'same_as<expr-type, int *&>' would be invalid
   34 |       { __lhs = std::forward<_Rhs>(__rhs) } -> same_as<_Lhs>;
      |                                                ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/span:455:35: note: candidate template ignored: constraints not satisfied [with _It = int *, _End = size_t]
  455 |   _LIBCPP_HIDE_FROM_ABI constexpr span(_It __first, _End __last)
      |                                   ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/span:454:13: note: because '__span_compatible_iterator<int *, element_type>' evaluated to false
  454 |   template <__span_compatible_iterator<element_type> _It, __span_compatible_sentinel_for<_It> _End>
      |             ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/span:226:5: note: because 'int *' does not satisfy 'contiguous_iterator'
  226 |     contiguous_iterator<_It> && __span_array_convertible<remove_reference_t<iter_reference_t<_It>>, _Tp>;
      |     ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:235:5: note: because 'int *' does not satisfy 'random_access_iterator'
  235 |     random_access_iterator<_Ip> && derived_from<_ITER_CONCEPT<_Ip>, contiguous_iterator_tag> &&
      |     ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:222:5: note: because 'int *' does not satisfy 'bidirectional_iterator'
  222 |     bidirectional_iterator<_Ip> && derived_from<_ITER_CONCEPT<_Ip>, random_access_iterator_tag> &&
      |     ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:215:5: note: because 'int *' does not satisfy 'forward_iterator'
  215 |     forward_iterator<_Ip> && derived_from<_ITER_CONCEPT<_Ip>, bidirectional_iterator_tag> && requires(_Ip __i) {
      |     ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:209:5: note: because 'int *' does not satisfy 'input_iterator'
  209 |     input_iterator<_Ip> && derived_from<_ITER_CONCEPT<_Ip>, forward_iterator_tag> && incrementable<_Ip> &&
      |     ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:195:26: note: because 'int *' does not satisfy 'input_or_output_iterator'
  195 | concept input_iterator = input_or_output_iterator<_Ip> && indirectly_readable<_Ip> && requires {
      |                          ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:140:6: note: because 'int *' does not satisfy 'weakly_incrementable'
  140 | } && weakly_incrementable<_Ip>;
      |      ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:123:5: note: because 'int *' does not satisfy 'movable'
  123 |     movable<_Ip> && requires(_Ip __i) {
      |     ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__concepts/movable.h:29:66: note: because 'assignable_from<int *&, int *>' evaluated to false
   29 | concept movable = is_object_v<_Tp> && move_constructible<_Tp> && assignable_from<_Tp&, _Tp> && swappable<_Tp>;
      |                                                                  ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__concepts/assignable.h:34:48: note: because 'same_as<expr-type, int *&>' would be invalid
   34 |       { __lhs = std::forward<_Rhs>(__rhs) } -> same_as<_Lhs>;
      |                                                ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:235:5: note: and 'int *' does not satisfy 'random_access_iterator'
  235 |     random_access_iterator<_Ip> && derived_from<_ITER_CONCEPT<_Ip>, contiguous_iterator_tag> &&
      |     ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:222:5: note: because 'int *' does not satisfy 'bidirectional_iterator'
  222 |     bidirectional_iterator<_Ip> && derived_from<_ITER_CONCEPT<_Ip>, random_access_iterator_tag> &&
      |     ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:215:5: note: because 'int *' does not satisfy 'forward_iterator'
  215 |     forward_iterator<_Ip> && derived_from<_ITER_CONCEPT<_Ip>, bidirectional_iterator_tag> && requires(_Ip __i) {
      |     ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:209:5: note: because 'int *' does not satisfy 'input_iterator'
  209 |     input_iterator<_Ip> && derived_from<_ITER_CONCEPT<_Ip>, forward_iterator_tag> && incrementable<_Ip> &&
      |     ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:195:26: note: because 'int *' does not satisfy 'input_or_output_iterator'
  195 | concept input_iterator = input_or_output_iterator<_Ip> && indirectly_readable<_Ip> && requires {
      |                          ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:140:6: note: because 'int *' does not satisfy 'weakly_incrementable'
  140 | } && weakly_incrementable<_Ip>;
      |      ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:123:5: note: because 'int *' does not satisfy 'movable'
  123 |     movable<_Ip> && requires(_Ip __i) {
      |     ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__concepts/movable.h:29:66: note: because 'assignable_from<int *&, int *>' evaluated to false
   29 | concept movable = is_object_v<_Tp> && move_constructible<_Tp> && assignable_from<_Tp&, _Tp> && swappable<_Tp>;
      |                                                                  ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__concepts/assignable.h:34:48: note: because 'same_as<expr-type, int *&>' would be invalid
   34 |       { __lhs = std::forward<_Rhs>(__rhs) } -> same_as<_Lhs>;
      |                                                ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:222:5: note: and 'int *' does not satisfy 'bidirectional_iterator'
  222 |     bidirectional_iterator<_Ip> && derived_from<_ITER_CONCEPT<_Ip>, random_access_iterator_tag> &&
      |     ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:215:5: note: because 'int *' does not satisfy 'forward_iterator'
  215 |     forward_iterator<_Ip> && derived_from<_ITER_CONCEPT<_Ip>, bidirectional_iterator_tag> && requires(_Ip __i) {
      |     ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:209:5: note: because 'int *' does not satisfy 'input_iterator'
  209 |     input_iterator<_Ip> && derived_from<_ITER_CONCEPT<_Ip>, forward_iterator_tag> && incrementable<_Ip> &&
      |     ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:195:26: note: because 'int *' does not satisfy 'input_or_output_iterator'
  195 | concept input_iterator = input_or_output_iterator<_Ip> && indirectly_readable<_Ip> && requires {
      |                          ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:140:6: note: because 'int *' does not satisfy 'weakly_incrementable'
  140 | } && weakly_incrementable<_Ip>;
      |      ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:123:5: note: because 'int *' does not satisfy 'movable'
  123 |     movable<_Ip> && requires(_Ip __i) {
      |     ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__concepts/movable.h:29:66: note: because 'assignable_from<int *&, int *>' evaluated to false
   29 | concept movable = is_object_v<_Tp> && move_constructible<_Tp> && assignable_from<_Tp&, _Tp> && swappable<_Tp>;
      |                                                                  ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__concepts/assignable.h:34:48: note: because 'same_as<expr-type, int *&>' would be invalid
   34 |       { __lhs = std::forward<_Rhs>(__rhs) } -> same_as<_Lhs>;
      |                                                ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:215:5: note: and 'int *' does not satisfy 'forward_iterator'
  215 |     forward_iterator<_Ip> && derived_from<_ITER_CONCEPT<_Ip>, bidirectional_iterator_tag> && requires(_Ip __i) {
      |     ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:209:5: note: because 'int *' does not satisfy 'input_iterator'
  209 |     input_iterator<_Ip> && derived_from<_ITER_CONCEPT<_Ip>, forward_iterator_tag> && incrementable<_Ip> &&
      |     ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:195:26: note: because 'int *' does not satisfy 'input_or_output_iterator'
  195 | concept input_iterator = input_or_output_iterator<_Ip> && indirectly_readable<_Ip> && requires {
      |                          ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:140:6: note: because 'int *' does not satisfy 'weakly_incrementable'
  140 | } && weakly_incrementable<_Ip>;
      |      ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:123:5: note: because 'int *' does not satisfy 'movable'
  123 |     movable<_Ip> && requires(_Ip __i) {
      |     ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__concepts/movable.h:29:66: note: because 'assignable_from<int *&, int *>' evaluated to false
   29 | concept movable = is_object_v<_Tp> && move_constructible<_Tp> && assignable_from<_Tp&, _Tp> && swappable<_Tp>;
      |                                                                  ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__concepts/assignable.h:34:48: note: because 'same_as<expr-type, int *&>' would be invalid
   34 |       { __lhs = std::forward<_Rhs>(__rhs) } -> same_as<_Lhs>;
      |                                                ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:209:5: note: and 'int *' does not satisfy 'input_iterator'
  209 |     input_iterator<_Ip> && derived_from<_ITER_CONCEPT<_Ip>, forward_iterator_tag> && incrementable<_Ip> &&
      |     ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:195:26: note: because 'int *' does not satisfy 'input_or_output_iterator'
  195 | concept input_iterator = input_or_output_iterator<_Ip> && indirectly_readable<_Ip> && requires {
      |                          ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:140:6: note: because 'int *' does not satisfy 'weakly_incrementable'
  140 | } && weakly_incrementable<_Ip>;
      |      ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:123:5: note: because 'int *' does not satisfy 'movable'
  123 |     movable<_Ip> && requires(_Ip __i) {
      |     ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__concepts/movable.h:29:66: note: because 'assignable_from<int *&, int *>' evaluated to false
   29 | concept movable = is_object_v<_Tp> && move_constructible<_Tp> && assignable_from<_Tp&, _Tp> && swappable<_Tp>;
      |                                                                  ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__concepts/assignable.h:34:48: note: because 'same_as<expr-type, int *&>' would be invalid
   34 |       { __lhs = std::forward<_Rhs>(__rhs) } -> same_as<_Lhs>;
      |                                                ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:195:26: note: and 'int *' does not satisfy 'input_or_output_iterator'
  195 | concept input_iterator = input_or_output_iterator<_Ip> && indirectly_readable<_Ip> && requires {
      |                          ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:140:6: note: because 'int *' does not satisfy 'weakly_incrementable'
  140 | } && weakly_incrementable<_Ip>;
      |      ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:123:5: note: because 'int *' does not satisfy 'movable'
  123 |     movable<_Ip> && requires(_Ip __i) {
      |     ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__concepts/movable.h:29:66: note: because 'assignable_from<int *&, int *>' evaluated to false
   29 | concept movable = is_object_v<_Tp> && move_constructible<_Tp> && assignable_from<_Tp&, _Tp> && swappable<_Tp>;
      |                                                                  ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__concepts/assignable.h:34:48: note: because 'same_as<expr-type, int *&>' would be invalid
   34 |       { __lhs = std::forward<_Rhs>(__rhs) } -> same_as<_Lhs>;
      |                                                ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:140:6: note: and 'int *' does not satisfy 'weakly_incrementable'
  140 | } && weakly_incrementable<_Ip>;
      |      ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:123:5: note: because 'int *' does not satisfy 'movable'
  123 |     movable<_Ip> && requires(_Ip __i) {
      |     ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__concepts/movable.h:29:66: note: because 'assignable_from<int *&, int *>' evaluated to false
   29 | concept movable = is_object_v<_Tp> && move_constructible<_Tp> && assignable_from<_Tp&, _Tp> && swappable<_Tp>;
      |                                                                  ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__concepts/assignable.h:34:48: note: because 'same_as<expr-type, int *&>' would be invalid
   34 |       { __lhs = std::forward<_Rhs>(__rhs) } -> same_as<_Lhs>;
      |                                                ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__iterator/concepts.h:123:5: note: and 'int *' does not satisfy 'movable'
  123 |     movable<_Ip> && requires(_Ip __i) {
      |     ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__concepts/movable.h:29:66: note: because 'assignable_from<int *&, int *>' evaluated to false
   29 | concept movable = is_object_v<_Tp> && move_constructible<_Tp> && assignable_from<_Tp&, _Tp> && swappable<_Tp>;
      |                                                                  ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__concepts/assignable.h:34:48: note: because 'same_as<expr-type, int *&>' would be invalid
   34 |       { __lhs = std::forward<_Rhs>(__rhs) } -> same_as<_Lhs>;
      |                                                ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__concepts/movable.h:29:66: note: and 'assignable_from<int *&, int *>' evaluated to false
   29 | concept movable = is_object_v<_Tp> && move_constructible<_Tp> && assignable_from<_Tp&, _Tp> && swappable<_Tp>;
      |                                                                  ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__concepts/assignable.h:34:48: note: because 'same_as<expr-type, int *&>' would be invalid
   34 |       { __lhs = std::forward<_Rhs>(__rhs) } -> same_as<_Lhs>;
      |                                                ^
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/__concepts/assignable.h:34:48: note: and 'same_as<expr-type, int *&>' would be invalid
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/span:444:13: note: candidate constructor not viable: requires 1 argument, but 2 were provided
  444 |   constexpr span(const span&) noexcept            = default;
      |             ^    ~~~~~~~~~~~
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/span:461:35: note: candidate constructor template not viable: requires single argument '__arr', but 2 arguments were provided
  461 |   _LIBCPP_HIDE_FROM_ABI constexpr span(type_identity_t<element_type> (&__arr)[_Sz]) noexcept
      |                                   ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/span:465:35: note: candidate constructor template not viable: requires single argument '__arr', but 2 arguments were provided
  465 |   _LIBCPP_HIDE_FROM_ABI constexpr span(array<_OtherElementType, _Sz>& __arr) noexcept
      |                                   ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/span:470:35: note: candidate constructor template not viable: requires single argument '__arr', but 2 arguments were provided
  470 |   _LIBCPP_HIDE_FROM_ABI constexpr span(const array<_OtherElementType, _Sz>& __arr) noexcept
      |                                   ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/span:474:35: note: candidate constructor template not viable: requires single argument '__r', but 2 arguments were provided
  474 |   _LIBCPP_HIDE_FROM_ABI constexpr span(_Range&& __r) : __data_(ranges::data(__r)), __size_{ranges::size(__r)} {}
      |                                   ^    ~~~~~~~~~~~~
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/span:477:35: note: candidate constructor template not viable: requires single argument '__other', but 2 arguments were provided
  477 |   _LIBCPP_HIDE_FROM_ABI constexpr span(const span<_OtherElementType, _OtherExtent>& __other) noexcept
      |                                   ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/cefs/b8/b829bf791ef3f80dbbdd19fc_clang-trunk-20251013/bin/../include/c++/v1/span:436:35: note: candidate constructor not viable: requires 0 arguments, but 2 were provided
  436 |   _LIBCPP_HIDE_FROM_ABI constexpr span() noexcept : __data_{nullptr}, __size_{0} {}
      |                                   ^
1 warning and 1 error generated.

You can try the reproducer in https://godbolt.org/z/9f1Yv8fa5

@zyn0217
Copy link
Contributor Author

zyn0217 commented Oct 14, 2025

@zeroomega We reverted this in #163322. Thanks for letting us know!

zyn0217 added a commit that referenced this pull request Oct 14, 2025
Reverts #162991

That patch breaks certain uses of VLAs when combined with constrained
types.

This is a pre-existing issue that occurs when concepts are instantiated
with sugar. See also #102353 and related PRs. I tried to fix it on top
of the status quo in #163167, but that approach turned out to be
unfeasible, and our maintainer was clearly unhappy with it, hence this
revert.

Even after this patch, some VLA uses remain broken on trunk (see the
example below), because our normalization patch depends on sugar to
correctly compile libc++, due to a very subtle underlying bug. Still,
this is the best attempt to mitigate the problem for now.

We discussed this and agreed that the long-term solution is to remove
the sugar dependencies from concepts, before the VLA issue is properly
resolved through a larger refactoring.

I'll add a related test (which passes with partially applied sugar)
after this revert, since I don't have a reduced example yet.
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Oct 14, 2025
…ion" (#163322)

Reverts llvm/llvm-project#162991

That patch breaks certain uses of VLAs when combined with constrained
types.

This is a pre-existing issue that occurs when concepts are instantiated
with sugar. See also #102353 and related PRs. I tried to fix it on top
of the status quo in #163167, but that approach turned out to be
unfeasible, and our maintainer was clearly unhappy with it, hence this
revert.

Even after this patch, some VLA uses remain broken on trunk (see the
example below), because our normalization patch depends on sugar to
correctly compile libc++, due to a very subtle underlying bug. Still,
this is the best attempt to mitigate the problem for now.

We discussed this and agreed that the long-term solution is to remove
the sugar dependencies from concepts, before the VLA issue is properly
resolved through a larger refactoring.

I'll add a related test (which passes with partially applied sugar)
after this revert, since I don't have a reduced example yet.
akadutta pushed a commit to akadutta/llvm-project that referenced this pull request Oct 14, 2025
Using the canonical form of SugarConverted was an oversight during the
iteration of e9972de. We now retain sugar for better diagnostics.
akadutta pushed a commit to akadutta/llvm-project that referenced this pull request Oct 14, 2025
…163322)

Reverts llvm#162991

That patch breaks certain uses of VLAs when combined with constrained
types.

This is a pre-existing issue that occurs when concepts are instantiated
with sugar. See also llvm#102353 and related PRs. I tried to fix it on top
of the status quo in llvm#163167, but that approach turned out to be
unfeasible, and our maintainer was clearly unhappy with it, hence this
revert.

Even after this patch, some VLA uses remain broken on trunk (see the
example below), because our normalization patch depends on sugar to
correctly compile libc++, due to a very subtle underlying bug. Still,
this is the best attempt to mitigate the problem for now.

We discussed this and agreed that the long-term solution is to remove
the sugar dependencies from concepts, before the VLA issue is properly
resolved through a larger refactoring.

I'll add a related test (which passes with partially applied sugar)
after this revert, since I don't have a reduced example yet.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category HLSL HLSL Language Support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants