Test: int_overflow.cpp int_overflow.cpp: In member function 'int PriceCalculator::calculateTotal(int, int)': int_overflow.cpp:8:24: error: expected '<' before '&' token 8 | if (static_cast<long long>(pricePerUnit) * static_cast<long long>(quantity) > static_cast<long long>(INT_MAX)) { return INT_MAX; } else { return pricePerUnit * quantity; } // Can overflow! | ^ int_overflow.cpp:8:24: error: expected type-specifier before '&' token int_overflow.cpp:8:24: error: expected '>' before '&' token int_overflow.cpp:8:24: error: expected '(' before '&' token int_overflow.cpp:8:25: error: 'lt' was not declared in this scope 8 | if (static_cast<long long>(pricePerUnit) * static_cast<long long>(quantity) > static_cast<long long>(INT_MAX)) { return INT_MAX; } else { return pricePerUnit * quantity; } // Can overflow! | ^~ int_overflow.cpp:8:27: error: expected ')' before ';' token 8 | if (static_cast<long long>(pricePerUnit) * static_cast<long long>(quantity) > static_cast<long long>(INT_MAX)) { return INT_MAX; } else { return pricePerUnit * quantity; } // Can overflow! | ^ int_overflow.cpp:8:40: error: expected initializer before ';' token 8 | if (static_cast<long long>(pricePerUnit) * static_cast<long long>(quantity) > static_cast<long long>(INT_MAX)) { return INT_MAX; } else { return pricePerUnit * quantity; } // Can overflow! | ^ int_overflow.cpp:8:40: error: expected ')' before ';' token int_overflow.cpp:8:12: note: to match this '(' 8 | if (static_cast<long long>(pricePerUnit) * static_cast<long long>(quantity) > static_cast<long long>(INT_MAX)) { return INT_MAX; } else { return pricePerUnit * quantity; } // Can overflow! | ^ int_overflow.cpp:8:69: error: expected '<' before '&' token 8 | if (static_cast<long long>(pricePerUnit) * static_cast<long long>(quantity) > static_cast<long long>(INT_MAX)) { return INT_MAX; } else { return pricePerUnit * quantity; } // Can overflow! | ^ int_overflow.cpp:8:69: error: expected type-specifier before '&' token int_overflow.cpp:8:69: error: expected '>' before '&' token int_overflow.cpp:8:69: error: expected '(' before '&' token int_overflow.cpp:8:70: error: 'lt' was not declared in this scope 8 | if (static_cast<long long>(pricePerUnit) * static_cast<long long>(quantity) > static_cast<long long>(INT_MAX)) { return INT_MAX; } else { return pricePerUnit * quantity; } // Can overflow! | ^~ int_overflow.cpp:8:72: error: expected ')' before ';' token 8 | if (static_cast<long long>(pricePerUnit) * static_cast<long long>(quantity) > static_cast<long long>(INT_MAX)) { return INT_MAX; } else { return pricePerUnit * quantity; } // Can overflow! | ^ int_overflow.cpp:8:83: error: 'gt' declared as reference but not initialized 8 | if (static_cast<long long>(pricePerUnit) * static_cast<long long>(quantity) > static_cast<long long>(INT_MAX)) { return INT_MAX; } else { return pricePerUnit * quantity; } // Can overflow! | ^~ int_overflow.cpp:8:113: error: expected '<' before '&' token 8 | if (static_cast<long long>(pricePerUnit) * static_cast<long long>(quantity) > static_cast<long long>(INT_MAX)) { return INT_MAX; } else { return pricePerUnit * quantity; } // Can overflow! | ^ int_overflow.cpp:8:113: error: expected type-specifier before '&' token int_overflow.cpp:8:113: error: expected '>' before '&' token int_overflow.cpp:8:113: error: expected '(' before '&' token int_overflow.cpp:8:116: error: expected ')' before ';' token 8 | if (static_cast<long long>(pricePerUnit) * static_cast<long long>(quantity) > static_cast<long long>(INT_MAX)) { return INT_MAX; } else { return pricePerUnit * quantity; } // Can overflow! | ^ int_overflow.cpp:8:127: error: redeclaration of 'long long int& gt' 8 | if (static_cast<long long>(pricePerUnit) * static_cast<long long>(quantity) > static_cast<long long>(INT_MAX)) { return INT_MAX; } else { return pricePerUnit * quantity; } // Can overflow! | ^~ int_overflow.cpp:8:83: note: 'long long int& gt' previously declared here 8 | if (static_cast<long long>(pricePerUnit) * static_cast<long long>(quantity) > static_cast<long long>(INT_MAX)) { return INT_MAX; } else { return pricePerUnit * quantity; } // Can overflow! | ^~ int_overflow.cpp:8:131: error: 'INT_MAX' was not declared in this scope 8 | if (static_cast<long long>(pricePerUnit) * static_cast<long long>(quantity) > static_cast<long long>(INT_MAX)) { return INT_MAX; } else { return pricePerUnit * quantity; } // Can overflow! | ^~~~~~~ int_overflow.cpp:2:1: note: 'INT_MAX' is defined in header ''; did you forget to '#include '? 1 | #include +++ |+#include 2 | int_overflow.cpp:8:161: error: 'else' without a previous 'if' 8 | if (static_cast<long long>(pricePerUnit) * static_cast<long long>(quantity) > static_cast<long long>(INT_MAX)) { return INT_MAX; } else { return pricePerUnit * quantity; } // Can overflow! | ^~~~