Skip to content

Commit

Permalink
test suggested change
Browse files Browse the repository at this point in the history
  • Loading branch information
rzblue committed Aug 27, 2024
1 parent dbeab8b commit c77cb14
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions hal/src/main/native/include/hal/simulation/SimDataValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,24 +84,24 @@ class SimDataValueBase : protected SimCallbackRegistryBase {
* default constructor)
*/
template <typename T, HAL_Value (*MakeValue)(T), const char* (*GetName)(),
T (*GetDefault)() = nullptr>
T (*GetDefault)() = [] {return T();}>
class SimDataValue final : public impl::SimDataValueBase<T, MakeValue> {
public:
// FIXME: GCC 12.1 gives the false positive "the address of <GetDefault> will
// never be NULL" because it doesn't realize the default template parameter can
// make GetDefault nullptr. In C++20, replace "T (*GetDefault)() = nullptr" with
// "T (*GetDefault)() = [] { return T(); }" and unconditionally call
// GetDefault() to fix the warning.
#if __GNUC__ >= 12
/*#if __GNUC__ >= 12
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Waddress"
#endif // __GNUC__ >= 12
#endif // __GNUC__ >= 12*/
SimDataValue()
: impl::SimDataValueBase<T, MakeValue>(
GetDefault != nullptr ? GetDefault() : T()) {}
#if __GNUC__ >= 12
GetDefault()) {}
/*#if __GNUC__ >= 12
#pragma GCC diagnostic pop
#endif // __GNUC__ >= 12
#endif // __GNUC__ >= 12*/
explicit SimDataValue(T value)
: impl::SimDataValueBase<T, MakeValue>(value) {}

Expand Down

0 comments on commit c77cb14

Please sign in to comment.