35 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// [func.require]10 11#include <type_traits>12#include <functional>13 14#include "test_macros.h"15 16template <typename T, int N>17struct Array18{19 typedef T type[N];20};21 22struct Type23{24 Array<char, 1>::type& f1();25 Array<char, 2>::type& f2() const;26};27 28int main(int, char**)29{30 static_assert(sizeof(std::__invoke(&Type::f1, std::declval<Type >())) == 1, "");31 static_assert(sizeof(std::__invoke(&Type::f2, std::declval<Type const >())) == 2, "");32 33 return 0;34}35