From 07df129b156ae982f659bbf281e64192d60af810 Mon Sep 17 00:00:00 2001 From: Nghia Truong Date: Thu, 3 Feb 2022 10:40:41 -0700 Subject: [PATCH 1/5] Fix compile error --- cpp/src/binaryop/compiled/util.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/src/binaryop/compiled/util.cpp b/cpp/src/binaryop/compiled/util.cpp index 9481c236142..cbd5184548e 100644 --- a/cpp/src/binaryop/compiled/util.cpp +++ b/cpp/src/binaryop/compiled/util.cpp @@ -45,7 +45,7 @@ struct common_type_functor { // Eg. d=t-t return data_type{type_to_id()}; } - return {}; + return std::nullopt; } }; template From 758cc53b4d5a908a81435302e9e5f20338cb4d7e Mon Sep 17 00:00:00 2001 From: Nghia Truong Date: Thu, 3 Feb 2022 12:05:41 -0700 Subject: [PATCH 2/5] Add comment --- cpp/src/binaryop/compiled/util.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cpp/src/binaryop/compiled/util.cpp b/cpp/src/binaryop/compiled/util.cpp index cbd5184548e..34225f90e05 100644 --- a/cpp/src/binaryop/compiled/util.cpp +++ b/cpp/src/binaryop/compiled/util.cpp @@ -45,6 +45,10 @@ struct common_type_functor { // Eg. d=t-t return data_type{type_to_id()}; } + + // A compiler bug may cause a compilation error when using empty initialize list to construct + // an std::optional object containing no `data_type` value. Therefore, we should explicitly + // return `std::nullopt` instead. return std::nullopt; } }; From f21ebacef41ddaaf0271dfcef27dd4f7bcf4fbe9 Mon Sep 17 00:00:00 2001 From: Nghia Truong Date: Thu, 3 Feb 2022 12:10:08 -0700 Subject: [PATCH 3/5] Fix comment typo --- cpp/src/binaryop/compiled/util.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/src/binaryop/compiled/util.cpp b/cpp/src/binaryop/compiled/util.cpp index 34225f90e05..d8f1eb03a16 100644 --- a/cpp/src/binaryop/compiled/util.cpp +++ b/cpp/src/binaryop/compiled/util.cpp @@ -46,7 +46,7 @@ struct common_type_functor { return data_type{type_to_id()}; } - // A compiler bug may cause a compilation error when using empty initialize list to construct + // A compiler bug may cause a compilation error when using empty initializer list to construct // an std::optional object containing no `data_type` value. Therefore, we should explicitly // return `std::nullopt` instead. return std::nullopt; From aea7b14e7000419688cb6fcad5d4b57166a90561 Mon Sep 17 00:00:00 2001 From: Nghia Truong Date: Thu, 3 Feb 2022 12:22:05 -0700 Subject: [PATCH 4/5] Add specific GCC version to clarify the bug --- cpp/src/binaryop/compiled/util.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cpp/src/binaryop/compiled/util.cpp b/cpp/src/binaryop/compiled/util.cpp index d8f1eb03a16..9f52a5e7886 100644 --- a/cpp/src/binaryop/compiled/util.cpp +++ b/cpp/src/binaryop/compiled/util.cpp @@ -46,9 +46,9 @@ struct common_type_functor { return data_type{type_to_id()}; } - // A compiler bug may cause a compilation error when using empty initializer list to construct - // an std::optional object containing no `data_type` value. Therefore, we should explicitly - // return `std::nullopt` instead. + // A GCC-10 compiler bug may cause a compilation error when using empty initializer list to + // construct an std::optional object containing no `data_type` value. Therefore, we should + // explicitly return `std::nullopt` instead. return std::nullopt; } }; From fbae4ea5d9b7b96b7fc6fd87473474c1465c0c7c Mon Sep 17 00:00:00 2001 From: Nghia Truong Date: Thu, 3 Feb 2022 12:33:45 -0700 Subject: [PATCH 5/5] Revert "Add specific GCC version to clarify the bug" This reverts commit aea7b14e7000419688cb6fcad5d4b57166a90561. --- cpp/src/binaryop/compiled/util.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cpp/src/binaryop/compiled/util.cpp b/cpp/src/binaryop/compiled/util.cpp index 9f52a5e7886..d8f1eb03a16 100644 --- a/cpp/src/binaryop/compiled/util.cpp +++ b/cpp/src/binaryop/compiled/util.cpp @@ -46,9 +46,9 @@ struct common_type_functor { return data_type{type_to_id()}; } - // A GCC-10 compiler bug may cause a compilation error when using empty initializer list to - // construct an std::optional object containing no `data_type` value. Therefore, we should - // explicitly return `std::nullopt` instead. + // A compiler bug may cause a compilation error when using empty initializer list to construct + // an std::optional object containing no `data_type` value. Therefore, we should explicitly + // return `std::nullopt` instead. return std::nullopt; } };