libcxx

libcxx mirror with random patches
git clone https://git.neptards.moe/neptards/libcxx.git
Log | Files | Refs

deduct.fail.cpp (1060B)


      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // <array>
     11 // UNSUPPORTED: c++98, c++03, c++11, c++14
     12 // UNSUPPORTED: libcpp-no-deduction-guides
     13 
     14 
     15 // template <class T, class... U>
     16 //   array(T, U...) -> array<T, 1 + sizeof...(U)>;
     17 //
     18 //  Requires: (is_same_v<T, U> && ...) is true. Otherwise the program is ill-formed.
     19 
     20 
     21 #include <array>
     22 #include <cassert>
     23 #include <cstddef>
     24 
     25 // std::array is explicitly allowed to be initialized with A a = { init-list };.
     26 // Disable the missing braces warning for this reason.
     27 #include "disable_missing_braces_warning.h"
     28 
     29 
     30 #include "test_macros.h"
     31 
     32 int main()
     33 {
     34     {
     35     std::array arr{1,2,3L}; // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'array'}}
     36     }
     37 }