File tree Expand file tree Collapse file tree 3 files changed +41
-0
lines changed Expand file tree Collapse file tree 3 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -1067,6 +1067,13 @@ template <typename Type, int NumElements> class vec {
1067
1067
template <typename T1, int T2> friend class vec ;
1068
1068
};
1069
1069
1070
+ #ifdef __cpp_deduction_guides
1071
+ // all compilers supporting deduction guides also support fold expressions
1072
+ template <class T , class ... U,
1073
+ class = detail::enable_if_t <(std::is_same<T, U>::value && ...)>>
1074
+ vec (T, U...)->vec<T, sizeof...(U) + 1>;
1075
+ #endif
1076
+
1070
1077
namespace detail {
1071
1078
1072
1079
// SwizzleOP represents expression templates that operate on vec.
Original file line number Diff line number Diff line change
1
+ // RUN: %clangxx -std=c++17 -fsyntax-only -Xclang -verify %s
2
+ // expected-no-diagnostics
3
+ // ==--------------- ctad.cpp - SYCL vector CTAD test --------------------==//
4
+ //
5
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
6
+ // See https://llvm.org/LICENSE.txt for license information.
7
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8
+ //
9
+ // ===----------------------------------------------------------------------===//
10
+ #include < CL/sycl.hpp>
11
+
12
+ namespace sycl = cl::sycl;
13
+
14
+ int main () {
15
+ sycl::vec v1 (1 );
16
+ static_assert (std::is_same_v<decltype (v1), sycl::vec<int , 1 >>);
17
+ sycl::vec v2 (1 , 2 );
18
+ static_assert (std::is_same_v<decltype (v2), sycl::vec<int , 2 >>);
19
+ }
Original file line number Diff line number Diff line change
1
+ // RUN: %clangxx -std=c++17 -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected %s
2
+ // ==--------------- ctad.cpp - SYCL vector CTAD fail test ------------------==//
3
+ //
4
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5
+ // See https://llvm.org/LICENSE.txt for license information.
6
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
+ //
8
+ // ===----------------------------------------------------------------------===//
9
+ #include < CL/sycl.hpp>
10
+
11
+ namespace sycl = cl::sycl;
12
+
13
+ int main () {
14
+ sycl::vec v (1 , .1 ); // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'vec'}}
15
+ }
You can’t perform that action at this time.
0 commit comments