https://gcc.gnu.org/g:ce964ffb653f7134f93b662a332a9467677066ac
commit r17-2308-gce964ffb653f7134f93b662a332a9467677066ac Author: Tomasz KamiĆski <[email protected]> Date: Fri Jul 10 15:02:13 2026 +0200 libstdc++: Test has_unique_object_representations with incomplete types. Covers LWG4113, "Disallow has_unique_object_representations<Incomplete[]>". libstdc++-v3/ChangeLog: * testsuite/20_util/has_unique_object_representations/neg.cc: New test. Diff: --- .../20_util/has_unique_object_representations/neg.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 000000000000..9654fb4b99ad --- /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" }
