Skip to content

Commit 69ce6c3

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 c6f433e commit 69ce6c3

File tree

2 files changed

+64
-1
lines changed

2 files changed

+64
-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: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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+
#include "test_macros.h"
20+
21+
class IC;
22+
23+
constexpr bool v1 = std::has_unique_object_representations<IC>::value;
24+
constexpr bool v2 = std::has_unique_object_representations<IC[]>::value;
25+
constexpr bool v3 = std::has_unique_object_representations<IC[1]>::value;
26+
constexpr bool v4 = std::has_unique_object_representations<IC[][1]>::value;
27+
28+
constexpr bool v5 = std::has_unique_object_representations_v<IC>;
29+
constexpr bool v6 = std::has_unique_object_representations_v<IC[]>;
30+
constexpr bool v7 = std::has_unique_object_representations_v<IC[1]>;
31+
constexpr bool v8 = std::has_unique_object_representations_v<IC[][1]>;
32+
33+
// expected-error@*:* 8 {{incomplete type 'IC' used in type trait expression}}
34+
35+
// TODO(LLVM 23): Remove this conditional inclusion.
36+
#if (defiend(TEST_CLANG_VER) && TEST_CLANG_VER < 2100) || (defined(TEST_APPLE_CLANG_VER) && TEST_APPLE_CLANG_VER < 1800)
37+
// expected-error@*:* 2 {{incomplete type 'remove_all_extents_t<IC>' (aka 'IC') used in type trait expression}}
38+
// expected-error@*:* 2 {{incomplete type 'remove_all_extents_t<IC[]>' (aka 'IC') used in type trait expression}}
39+
// expected-error@*:* 2 {{incomplete type 'remove_all_extents_t<IC[1]>' (aka 'IC') used in type trait expression}}
40+
// expected-error@*:* 2 {{incomplete type 'remove_all_extents_t<IC[][1]>' (aka 'IC') used in type trait expression}}
41+
#endif
42+
43+
enum E {
44+
v9 = std::has_unique_object_representations<E>::value,
45+
v10 = std::has_unique_object_representations<E[]>::value,
46+
v11 = std::has_unique_object_representations<E[1]>::value,
47+
v12 = std::has_unique_object_representations<E[][1]>::value,
48+
49+
v13 = std::has_unique_object_representations_v<E>,
50+
v14 = std::has_unique_object_representations_v<E[]>,
51+
v15 = std::has_unique_object_representations_v<E[1]>,
52+
v16 = std::has_unique_object_representations_v<E[][1]>,
53+
54+
// expected-error@*:* 8 {{incomplete type 'E' used in type trait expression}}
55+
56+
// TODO(LLVM 23): Remove this conditional inclusion.
57+
#if (defiend(TEST_CLANG_VER) && TEST_CLANG_VER < 2100) || (defined(TEST_APPLE_CLANG_VER) && TEST_APPLE_CLANG_VER < 1800)
58+
// expected-error@*:* 2 {{incomplete type 'remove_all_extents_t<E>' (aka 'E') used in type trait expression}}
59+
// expected-error@*:* 2 {{incomplete type 'remove_all_extents_t<E[]>' (aka 'E') used in type trait expression}}
60+
// expected-error@*:* 2 {{incomplete type 'remove_all_extents_t<E[1]>' (aka 'E') used in type trait expression}}
61+
// expected-error@*:* 2 {{incomplete type 'remove_all_extents_t<E[][1]>' (aka 'E') used in type trait expression}}
62+
#endif
63+
};

0 commit comments

Comments
 (0)