Polyspace: expression must have a constant value
Ältere Kommentare anzeigen
Hello guys,
I have this C++17 code:
#define I2C_BUS_MAX_BUS_ITEMS 3
struct my_bus_t {
int bus{-1};
bool is_external;
};
static inline constexpr my_bus_t initBus(int bus)
{
my_bus_t ret{};
ret.bus = bus;
ret.is_external = false;
return ret;
}
constexpr my_bus_t buses[I2C_BUS_MAX_BUS_ITEMS] = {
initBus(1),
initBus(2),
};

This is the configuration setting.
It compiles well, but there is a problem in Polyspace: "expression must have a constant value".
Thank you in advance.
2 Kommentare
Walter Roberson
am 28 Apr. 2022
Which expression is it flagging?
Zulham Mr
am 28 Apr. 2022
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Bug Finder Analysis in Polyspace Platform User Interface finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!