Skip to content

Commit cd565b5

Browse files
authored
Make EValue template constructor MSVC friendly
Differential Revision: D65402442 Pull Request resolved: #6631
1 parent 287488f commit cd565b5

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

runtime/core/evalue.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,12 +242,13 @@ struct EValue {
242242
// Template constructor that allows construction from types that can be
243243
// dereferenced to produce a type that EValue can be implicitly constructed
244244
// from.
245-
template <typename T>
246-
/*implicit*/ EValue(
247-
T&& value,
248-
typename std::enable_if<std::is_convertible<
249-
decltype(*std::forward<T>(value)),
250-
EValue>::value>::type* = 0) {
245+
template <
246+
typename T,
247+
typename = typename std::enable_if<std::is_convertible<
248+
decltype(*std::forward<T>(std::declval<T>())), // declval to simulate
249+
// forwarding
250+
EValue>::value>::type>
251+
/*implicit*/ EValue(T&& value) {
251252
ET_CHECK_MSG(value != nullptr, "Pointer is null.");
252253
// Note that this ctor does not initialize this->tag directly; it is set by
253254
// moving in the new value.

runtime/core/exec_aten/exec_aten.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#pragma once
1010

1111
#include <executorch/runtime/core/tensor_shape_dynamism.h> // @manual
12+
#include <executorch/runtime/platform/compiler.h>
1213
#ifdef USE_ATEN_LIB
1314
#include <ATen/Tensor.h> // @manual
1415
#include <c10/core/Device.h>

0 commit comments

Comments
 (0)