Skip to content

Commit 5a0b85c

Browse files
author
abacus_fixer
committed
fix: add missing variadic macro argument in Tensor::sync
REQUIRES_OK(expr, ...) is a variadic macro defined in macros.h. C++14 requires at least one argument be passed for the ... parameter; omitting it is a C++20 extension that triggers -Wvariadic-macro-arguments-omitted under icpx -pedantic. Tensor::sync was the only call site in the whole codebase that omitted the second argument. Add a descriptive error message to keep the macro usage consistent with every other REQUIRES_OK call.
1 parent e29103d commit 5a0b85c

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

  • source/source_base/module_container/ATen/core

source/source_base/module_container/ATen/core/tensor.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,8 @@ bool Tensor::AllocateFrom(const Tensor& other, const TensorShape& shape) {
295295

296296
void Tensor::sync(const Tensor& rhs) {
297297
REQUIRES_OK(this->data_type_ == rhs.data_type_
298-
&& this->device_ == rhs.device_)
298+
&& this->device_ == rhs.device_,
299+
"sync: data_type and device must match between tensors")
299300

300301
if (this->shape_ == rhs.shape_) {
301302
TEMPLATE_ALL_2(data_type_, device_,

0 commit comments

Comments
 (0)