wpilibsuite / allwpilib

Official Repository of WPILibJ and WPILibC
https://wpilib.org/
Other
1.07k stars 614 forks source link

old commands pidwrapper constructors should be public? #3898

Closed virtuald closed 2 years ago

virtuald commented 2 years ago

Describe the bug

Each of the constructors in PID{AnalogGyro, AnalogInput, ... etc} are inherited from their derived class as private. They don't seem very useful.

sciencewhiz commented 2 years ago

I'm not a C++ expert, but this code from RobotBuilder shouldn't compile if this was true, right? encoder.reset(new frc::PIDEncoder(0, 1, false, frc::Encoder::k4X));

calcmogul commented 2 years ago

Constructor inheritance also inherits the access specification. From https://en.cppreference.com/w/cpp/language/using_declaration#Inheriting_constructors:

If overload resolution selects an inherited constructor, it is accessible if it would be accessible when used to construct an object of the corresponding base class: the accessibility of the using-declaration that introduced it is ignored.

https://godbolt.org/z/hGrcdnMhq

virtuald commented 2 years ago

Bug on my side.