[committed] libstdc++: Test has_unique_object_representations with incomplete types.

Tomasz Kamiński tkaminsk@redhat.com
Fri Jul 10 13:32:20 GMT 2026


Covers LWG4113, "Disallow has_unique_object_representations<Incomplete[]>".

libstdc++-v3/ChangeLog:

	* testsuite/20_util/has_unique_object_representations/neg.cc:
	New test.
---
 .../has_unique_object_representations/neg.cc      | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
 create mode 100644 libstdc++-v3/testsuite/20_util/has_unique_object_representations/neg.cc

diff --git a/libstdc++-v3/testsuite/20_util/has_unique_object_representations/neg.cc b/libstdc++-v3/testsuite/20_util/has_unique_object_representations/neg.cc
new file mode 100644
index 00000000000..9654fb4b99a
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/has_unique_object_representations/neg.cc
@@ -0,0 +1,15 @@
+// { dg-do compile { target c++17 } }
+
+#include <type_traits>
+
+struct Incomplete;
+
+static_assert(std::has_unique_object_representations_v<Incomplete>);       // { dg-error "here" }
+static_assert(std::has_unique_object_representations_v<const Incomplete>); // { dg-error "here" }
+static_assert(std::has_unique_object_representations_v<Incomplete[10]>);   // { dg-error "here" }
+static_assert(std::has_unique_object_representations_v<Incomplete[]>);     // { dg-error "here" }
+
+// { dg-prune-output "invalid use of incomplete type" }
+// { dg-prune-output "template argument must be a complete" }
+// { dg-prune-output "'value' is not a member of 'std::has_unique_object_representations" }
+// { dg-prune-output "static assertion" }
-- 
2.54.0



More information about the Libstdc++ mailing list