brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · 7ab842b Raw
39 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++1410 11// <optional>12 13// template<class T>14//   optional(T) -> optional<T>;15 16#include <cassert>17#include <optional>18 19struct A {};20 21int main(int, char**) {22  //  Test the explicit deduction guides23 24  //  Test the implicit deduction guides25 26  // clang-format off27  {28    //  optional()29    std::optional opt; // expected-error-re {{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}optional'}}30  }31 32  {33    //  optional(nullopt_t)34    std::optional opt(std::nullopt); // expected-error-re@optional:* {{static assertion failed{{.*}}instantiation of optional with nullopt_t is ill-formed}}35  }36  // clang-format on37  return 0;38}39