Skip to content

Conversation

@H-G-Hristov
Copy link
Contributor

@H-G-Hristov H-G-Hristov commented Apr 1, 2025

…` `-Winvalid-specialization` tests

Addresses comment:
https://github.com/llvm/llvm-project/pull/128649/files#r2022341035

Drive-by fix: libcxx/test/std/language.support/support.initlist/support.initlist.syn/specialization.verify.cpp

https://clang.llvm.org/docs/DiagnosticsReference.html#winvalid-specialization
@H-G-Hristov H-G-Hristov changed the title [libc++][type_traits] reference_{constructs|converts}_from_temporary -Winvalid-specialization tests [libc++][type_traits] reference_{constructs|converts}_from_temporary with -Winvalid-specialization tests Apr 1, 2025
@frederick-vs-ja
Copy link
Contributor

I think it's more consistent to add the coverage to libcxx/test/libcxx/type_traits/no_specializations.verify.cpp.

@Zingam Zingam marked this pull request as ready for review April 2, 2025 08:58
@Zingam Zingam requested a review from a team as a code owner April 2, 2025 08:58
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Apr 2, 2025
@llvmbot
Copy link
Member

llvmbot commented Apr 2, 2025

@llvm/pr-subscribers-libcxx

Author: Hristo Hristov (H-G-Hristov)

Changes

Addresses comment:
https://github.com/llvm/llvm-project/pull/128649/files#r2022341035

Drive-by fix: libcxx/test/std/language.support/support.initlist/support.initlist.syn/specialization.verify.cpp

https://clang.llvm.org/docs/DiagnosticsReference.html#winvalid-specialization


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

2 Files Affected:

  • (modified) libcxx/test/libcxx/type_traits/no_specializations.verify.cpp (+8-2)
  • (modified) libcxx/test/std/language.support/support.initlist/support.initlist.syn/specialization.verify.cpp (+1-1)
diff --git a/libcxx/test/libcxx/type_traits/no_specializations.verify.cpp b/libcxx/test/libcxx/type_traits/no_specializations.verify.cpp
index 807d01e381b49..38560161f162e 100644
--- a/libcxx/test/libcxx/type_traits/no_specializations.verify.cpp
+++ b/libcxx/test/libcxx/type_traits/no_specializations.verify.cpp
@@ -156,6 +156,12 @@ SPECIALIZE_UTT(is_unbounded_array);     // expected-error 2 {{cannot be speciali
 #  if TEST_STD_VER >= 23
 SPECIALIZE_UTT(is_implicit_lifetime); // expected-error 2 {{cannot be specialized}}
 SPECIALIZE_UTT(is_scoped_enum);       // expected-error 2 {{cannot be specialized}}
+#    if __has_builtin(__reference_constructs_from_temporary)
+SPECIALIZE_BTT(reference_constructs_from_temporary); // expected-error 2 {{cannot be specialized}}
+#    endif
+#    if __has_builtin(__reference_converts_from_temporary)
+SPECIALIZE_BTT(reference_converts_from_temporary); // expected-error 2 {{cannot be specialized}}
+#    endif
 #  endif
 
 #  if TEST_STD_VER >= 26
@@ -177,8 +183,8 @@ struct std::conditional<true, S, S>; // expected-error {{cannot be specialized}}
 template <>
 struct std::enable_if<true, S>; // expected-error {{cannot be specialized}}
 
-#if TEST_STD_VER >= 20
+#  if TEST_STD_VER >= 20
 template <>
 struct std::integral_constant<S, {}>; // expected-error {{cannot be specialized}}
-#endif
+#  endif
 #endif
diff --git a/libcxx/test/std/language.support/support.initlist/support.initlist.syn/specialization.verify.cpp b/libcxx/test/std/language.support/support.initlist/support.initlist.syn/specialization.verify.cpp
index 11807059c71b0..54b2f6db41c7e 100644
--- a/libcxx/test/std/language.support/support.initlist/support.initlist.syn/specialization.verify.cpp
+++ b/libcxx/test/std/language.support/support.initlist/support.initlist.syn/specialization.verify.cpp
@@ -15,7 +15,7 @@
 
 #include <initializer_list>
 
-#if !__has_warning("-Winvalid-specializations")
+#if !__has_warning("-Winvalid-specialization")
 // expected-no-diagnostics
 #else
 

Copy link
Contributor

@philnik777 philnik777 left a comment

Choose a reason for hiding this comment

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

Thanks!

@Zingam Zingam merged commit b93376f into llvm:main Apr 3, 2025
80 checks passed
@H-G-Hristov H-G-Hristov deleted the hgh/libcxx/references_xxxxxx_from_temporary-no-specialization-tests branch April 8, 2025 05:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants