According to the C++23 standard, what is the output of this program?
#include <iostream>
int main() {
int a = 0;
decltype(a) b = a;
b++;
std::cout << a << b;
}What type is decltype(a)?
01
According to §[dcl.type.decltype]¶1.3 in the standard:
For an expression
E, the type denoted bydecltype(E)is defined as follows:— (...)
— otherwise, if
Eis an unparenthesized id-expression (...),decltype(E)is the type of the entity named byE.
The type of a is int, so the type of b is also int.