0

Why C++ compiler doesn't guess that its initializer_list and not int?>

#include <iostream>
#include <typeinfo>

int main() {
    auto f = 45; // int, fine.
    auto li {12,2,54,65}; // initializer_list, as expected/
    auto A{12};  // ????
    std::cout<<typeid(A).name()<<std::endl;
    return 0;
}
Person.Junkie
  • 1,816
  • 4
  • 21
  • 31

0 Answers0