brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 16c6f0b Raw
63 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// <forward_list>10 11// forward_list()                 // constexpr since C++2612// forward_list::iterator()       // constexpr since C++2613// forward_list::const_iterator() // constexpr since C++2614 15#include <forward_list>16#include <cassert>17 18#include "test_macros.h"19#include "min_allocator.h"20 21struct A {22  std::forward_list<A> d;23  std::forward_list<A>::iterator it;24  std::forward_list<A>::const_iterator it2;25};26 27#if TEST_STD_VER >= 1128struct B {29  typedef std::forward_list<B, min_allocator<B>> FList;30  FList d;31  FList::iterator it;32  FList::const_iterator it2;33};34#endif35 36TEST_CONSTEXPR_CXX26 bool test() {37  {38    A a;39    assert(a.d.empty());40    a.it  = a.d.begin();41    a.it2 = a.d.cbefore_begin();42  }43#if TEST_STD_VER >= 1144  {45    B b;46    assert(b.d.empty());47    b.it  = b.d.begin();48    b.it2 = b.d.cbefore_begin();49  }50#endif51 52  return true;53}54 55int main(int, char**) {56  assert(test());57#if TEST_STD_VER >= 2658  static_assert(test());59#endif60 61  return 0;62}63