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 // UNSUPPORTED: c++03, c++11, c++14, c++17
10 // UNSUPPORTED: libcpp-no-concepts
11 // UNSUPPORTED: msvc
12 
13 // std::ranges::begin
14 // std::ranges::cbegin
15 //   Test the fix for https://llvm.org/PR54100
16 
17 #include <ranges>
18 #include <cassert>
19 
20 #include "test_macros.h"
21 
22 struct A {
23   int m[0];
24 };
25 static_assert(sizeof(A) == 0); // an extension supported by GCC and Clang
26 
27 int main(int, char**)
28 {
29   A a[10];
30   std::same_as<A*> auto p = std::ranges::begin(a);
31   assert(p == a);
32   std::same_as<const A*> auto cp = std::ranges::cbegin(a);
33   assert(cp == a);
34 
35   return 0;
36 }
37