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 10 // <optional> 11 12 // constexpr optional(in_place_t); 13 14 // Test that the SFINAE "is_constructible<value_type>" isn't evaluated by the 15 // in_place_t constructor with no arguments when the Clang is trying to check 16 // copy constructor. 17 18 #include <optional> 19 #include <type_traits> 20 #include <cassert> 21 22 #include "test_macros.h" 23 #include "archetypes.h" 24 25 using std::optional; 26 27 struct Wrapped { 28 struct Inner { 29 bool Dummy = true; 30 }; 31 std::optional<Inner> inner; 32 }; 33 main(int,char **)34int main(int, char**) { 35 static_assert(std::is_default_constructible<Wrapped::Inner>::value, ""); 36 Wrapped w; 37 w.inner.emplace(); 38 assert(w.inner.has_value()); 39 40 return 0; 41 } 42