brintos

brintos / llvm-project-archived public Read only

0
0
Text · 892 B · 304ef2d Raw
36 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// UNSUPPORTED: c++03, c++11, c++14, c++1710// UNSUPPORTED: msvc11 12// std::ranges::end13// std::ranges::cend14//   Test the fix for https://llvm.org/PR5410015 16#include <ranges>17#include <cassert>18 19#include "test_macros.h"20 21struct A {22  int m[0];23};24static_assert(sizeof(A) == 0); // an extension supported by GCC and Clang25 26int main(int, char**)27{28  A a[10];29  std::same_as<A*> auto p = std::ranges::end(a);30  assert(p == a + 10);31  std::same_as<const A*> auto cp = std::ranges::cend(a);32  assert(cp == a + 10);33 34  return 0;35}36