Skip to content

Fix Class Template Argument Deduction warning#107

Merged
m-olko merged 2 commits into
mainfrom
m-olko-patch-1
May 20, 2026
Merged

Fix Class Template Argument Deduction warning#107
m-olko merged 2 commits into
mainfrom
m-olko-patch-1

Conversation

@m-olko
Copy link
Copy Markdown
Contributor

@m-olko m-olko commented May 20, 2026

This PR

In grpc_sync.cpp , code declares time points like this:

std::chrono::time_point now = std::chrono::steady_clock::now();

std::chrono::time_point is a template class that requires template arguments (the clock type and the duration type)``` template<class Clock, class Duration = typename Clock::duration> class time_point;

In the upstream code, the template arguments are omitted ( `std::chrono::time_point now` ).

Under C++17, the compiler uses a feature called CTAD (Class Template Argument Deduction) to automatically deduce the missing template arguments from the right-hand side ( std::chrono::steady_clock::now() ). So it deduces the type to be std::chrono::time_pointstd::chrono::steady_clock . Some more restrictive type-checkers are warning users of such use. This patch fixes that and explicitly defines time_point type

In  `grpc_sync.cpp` , code declares time points like this:
```
std::chrono::time_point now = std::chrono::steady_clock::now();
```
`std::chrono::time_point`  is a template class that requires template arguments (the clock type and the duration type)```
template<class Clock, class Duration = typename Clock::duration>
class time_point;
```
In the upstream code, the template arguments are omitted ( `std::chrono::time_point now` ).                                                                                                                                                                                                                
  Under C++17, the compiler uses a feature called CTAD (Class Template Argument Deduction) to automatically deduce the missing template arguments from the right-hand side ( std::chrono::steady_clock::now() ). So it deduces the type to be  std::chrono::time_point<std::chrono::steady_clock> . Some more restrictive type-checkers are warning users of such use. This patch fixes that and explicitly defines time_point type

Signed-off-by: Marcin Olko <molko@google.com>
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the variable declarations in CheckGracePeriod and WaitForUpdates to use std::chrono::steady_clock::time_point instead of the incomplete std::chrono::time_point, which resolves CTAD warnings. The reviewer suggests using auto for these declarations to improve readability and maintainability while still addressing the warnings.

Comment thread providers/flagd/src/sync/grpc/grpc_sync.cpp Outdated
Comment thread providers/flagd/src/sync/grpc/grpc_sync.cpp Outdated
Comment thread providers/flagd/src/sync/grpc/grpc_sync.cpp Outdated
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Marcin Olko <molko@google.com>
@m-olko m-olko merged commit 93f2fa1 into main May 20, 2026
3 checks passed
@m-olko m-olko deleted the m-olko-patch-1 branch May 20, 2026 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants