opencensus-cpp
opencensus-cpp copied to clipboard
GCC build error
When compiling under GCC 11.2.0 with -std=c++20
the following line causes an error.
https://github.com/census-instrumentation/opencensus-cpp/blob/afe0460f92fb78e6d6cf8c8a30ced9bc5e2e57d3/opencensus/common/internal/stats_object.h#L81
The specific error:
external/io_opencensus_cpp/opencensus/common/internal/stats_object.h:81:26: error: expected ')' before 'num_stats'
81 | StatsObject<N>(uint16_t num_stats, absl::Duration interval, absl::Time now);
| ~ ^~~~~~~~~~
| )
What i believe is the cause of the error:
StatsObject<N>
I've never seen anyone repeat the template parameter in the declaration of the constructor like this before and believe this to be a syntax error that was previously not being caught by GCC.
- StatsObject<N>(uint16_t num_stats, absl::Duration interval, absl::Time now);
+ StatsObject(uint16_t num_stats, absl::Duration interval, absl::Time now);
The above change solves the build issue for me.
Created a patch https://github.com/census-instrumentation/opencensus-cpp/pull/466