Files
clang-p2996/libcxx/test/std/thread/thread.barrier/ctor.compile.pass.cpp
Edoardo Sanguineti c77af00eb9 [libc++] mark barrier constructor as explicit in <barrier>
If I read the standard correctly, the public constructor of "barrier" should be marked as "constexpr explicit".
I see some of the internal classes used by the barrier header are correctly marked but I think, if I'm not mistaken, the standard would like the public class to have the correct definition as well.

Because the implementation that llvm uses by default is not constexpr friendly at this time, this revision will focus on only marking it as explicit.

Reviewed By: #libc, philnik, Mordante

Spies: philnik, Mordante, libcxx-commits

Differential Revision: https://reviews.llvm.org/D154590
2023-07-12 12:31:16 -07:00

23 lines
736 B
C++

//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: no-threads
// UNSUPPORTED: c++03, c++11
// <barrier>
// explicit barrier(ptrdiff_t __count, _CompletionF __completion = _CompletionF());
// Make sure that the ctor of barrier is explicit.
#include <barrier>
#include "test_convertible.h"
static_assert(!test_convertible<std::barrier<>, std::ptrdiff_t>(), "This constructor must be explicit");