I am observing inconsistent template arguments shown in Visual Studio's "Call Stack" window.
Here's one example:
template<class T>
class Class {
public:
Class() { method(); }
void method() { int i = 0; }
};
template<int I>
class ArgumentClass {};
int main() {
Class<ArgumentClass<100>> instance100;
Class<ArgumentClass<150>> instance150;
Class<ArgumentClass<200>> instance200;
Class<ArgumentClass<250>> instance250;
}
Note that while Line 14 is executed with a value of 150, the call stack shows a value of 250. Why is that?
Note that this is in Debug mode, so I would not expect any optimization.
I even see more complicated cases where the arguments differ from one function call (on the same object) to the next: