Skip to content

Commit 2fabc5b

Browse files
[libc++] Test LWG4113: Disallow has_unique_object_representations<Incomplete[]>
LWG4113 can be considered implemented in Clang 19 due to 6451806. A follow-up change e59ed0f simplified error messages.
1 parent f0bb5cf commit 2fabc5b

File tree

2 files changed

+58
-1
lines changed

2 files changed

+58
-1
lines changed

libcxx/docs/Status/Cxx2cIssues.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
"`LWG4085 <https://wg21.link/LWG4085>`__","``ranges::generate_random``'s helper lambda should specify the return type","2024-11 (Wrocław)","","","`#118347 <https://github.com/llvm/llvm-project/issues/118347>`__",""
9393
"`LWG4088 <https://wg21.link/LWG4088>`__","``println`` ignores the locale imbued in ``std::ostream``","2024-11 (Wrocław)","|Complete|","18","`#118348 <https://github.com/llvm/llvm-project/issues/118348>`__",""
9494
"`LWG4112 <https://wg21.link/LWG4112>`__","``has-arrow`` should required ``operator->()`` to be ``const``-qualified","2024-11 (Wrocław)","","","`#118349 <https://github.com/llvm/llvm-project/issues/118349>`__",""
95-
"`LWG4113 <https://wg21.link/LWG4113>`__","Disallow ``has_unique_object_representations<Incomplete[]>``","2024-11 (Wrocław)","|Complete|","","`#118350 <https://github.com/llvm/llvm-project/issues/118350>`__",""
95+
"`LWG4113 <https://wg21.link/LWG4113>`__","Disallow ``has_unique_object_representations<Incomplete[]>``","2024-11 (Wrocław)","|Complete|","19","`#118350 <https://github.com/llvm/llvm-project/issues/118350>`__",""
9696
"`LWG4119 <https://wg21.link/LWG4119>`__","``generator::promise_type::yield_value(ranges::elements_of<R, Alloc>)``'s nested ``generator`` may be ill-formed","2024-11 (Wrocław)","","","`#118351 <https://github.com/llvm/llvm-project/issues/118351>`__",""
9797
"`LWG4124 <https://wg21.link/LWG4124>`__","Cannot format ``zoned_time`` with resolution coarser than ``seconds``","2024-11 (Wrocław)","","","`#118352 <https://github.com/llvm/llvm-project/issues/118352>`__",""
9898
"`LWG4126 <https://wg21.link/LWG4126>`__","Some feature-test macros for fully freestanding features are not yet marked freestanding","2024-11 (Wrocław)","","","`#118353 <https://github.com/llvm/llvm-project/issues/118353>`__",""
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
// REQUIRES: std-at-least-c++17
10+
11+
// <type_traits>
12+
13+
// has_unique_object_representations
14+
15+
// Verify that has_unique_object_representations(_v) rejects incomplete class and enumeration types and arrays thereof.
16+
17+
#include <type_traits>
18+
19+
class IC;
20+
21+
constexpr bool v1 = std::has_unique_object_representations<IC>::value;
22+
// expected-error@-1 {{incomplete type 'IC' used in type trait expression}}
23+
constexpr bool v2 = std::has_unique_object_representations<IC[]>::value;
24+
// expected-error@-1 {{incomplete type 'IC' used in type trait expression}}
25+
constexpr bool v3 = std::has_unique_object_representations<IC[1]>::value;
26+
// expected-error@-1 {{incomplete type 'IC' used in type trait expression}}
27+
constexpr bool v4 = std::has_unique_object_representations<IC[][1]>::value;
28+
// expected-error@-1 {{incomplete type 'IC' used in type trait expression}}
29+
30+
constexpr bool v5 = std::has_unique_object_representations_v<IC>;
31+
// expected-error@-1 {{incomplete type 'IC' used in type trait expression}}
32+
constexpr bool v6 = std::has_unique_object_representations_v<IC[]>;
33+
// expected-error@-1 {{incomplete type 'IC' used in type trait expression}}
34+
constexpr bool v7 = std::has_unique_object_representations_v<IC[1]>;
35+
// expected-error@-1 {{incomplete type 'IC' used in type trait expression}}
36+
constexpr bool v8 = std::has_unique_object_representations_v<IC[][1]>;
37+
// expected-error@-1 {{incomplete type 'IC' used in type trait expression}}
38+
39+
enum E {
40+
v9 = std::has_unique_object_representations<E>::value,
41+
// expected-error@-1 {{incomplete type 'E' used in type trait expression}}
42+
v10 = std::has_unique_object_representations<E[]>::value,
43+
// expected-error@-1 {{incomplete type 'E' used in type trait expression}}
44+
v11 = std::has_unique_object_representations<E[1]>::value,
45+
// expected-error@-1 {{incomplete type 'E' used in type trait expression}}
46+
v12 = std::has_unique_object_representations<E[][1]>::value,
47+
// expected-error@-1 {{incomplete type 'E' used in type trait expression}}
48+
49+
v13 = std::has_unique_object_representations_v<E>,
50+
// expected-error@-1 {{incomplete type 'E' used in type trait expression}}
51+
v14 = std::has_unique_object_representations_v<E[]>,
52+
// expected-error@-1 {{incomplete type 'E' used in type trait expression}}
53+
v15 = std::has_unique_object_representations_v<E[1]>,
54+
// expected-error@-1 {{incomplete type 'E' used in type trait expression}}
55+
v16 = std::has_unique_object_representations_v<E[][1]>,
56+
// expected-error@-1 {{incomplete type 'E' used in type trait expression}}
57+
};

0 commit comments

Comments
 (0)