fix: GCC compilation issue caused by template specialization#287
Conversation
WalkthroughReplaces a full Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
include/Async/Task.h (2)
197-222: Disallow reference T to avoid optional ill-formed instantiations.optional cannot hold reference types; guard early to improve diagnostics.
struct promise_type : promise_base, promise_result { + static_assert(!std::is_reference_v<T>, + "Task<T> does not support reference types; use std::reference_wrapper<T> if needed."); promise_type(std::source_location location = std::source_location::current()) {
338-339: Minor: make return_void constexpr.Tiny polish; communicates intent and enables constant-eval friendliness.
- void return_void() noexcept {} + constexpr void return_void() noexcept {}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
include/Async/Task.h(3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: windows (windows-2025)
- GitHub Check: linux (ubuntu-24.04, release)
- GitHub Check: macos (macos-15, release)
- GitHub Check: macos (macos-15, debug)
- GitHub Check: linux (ubuntu-24.04, debug)
- GitHub Check: build (ubuntu-24.04)
- GitHub Check: build (windows-2025)
- GitHub Check: build (macos-15)
🔇 Additional comments (2)
include/Async/Task.h (2)
7-11: Includes look right for the new implementation.Adding , <type_traits>, and is necessary for the value storage and forwarding. LGTM.
191-196: Structural verification confirms pattern is sound; manual compile check required on target compilers.The bool-gated template specialization pattern is correctly implemented:
- Primary template (line 192) declares
promise_result_impl<V, bool = std::is_void_v<V>>- Alias (line 195) correctly uses
promise_result_impl<T>- Specialization for
false(line 325): non-void case withstd::optional<V>storage- Specialization for
true(line 337): void case with no storageThis pattern correctly avoids GCC specialization pitfalls by using explicit bool NTTP gating rather than partial specialization on void/non-void.
However, the sandbox lacks C++ compilers for the requested cross-compiler verification (GCC, Clang, MSVC with C++23). Please manually verify compilation on your target compilers before merging.
…lization is not allowed outsideof namespace scope
|
Now it can be built with gcc! |
|
Thanks. |
Summary by CodeRabbit
Refactor
Bug Fixes