How do auto arguments work internally?

Viewed 132

Consider the code,

#include <cstdio>

auto f(const auto &loc){
  printf("Location: %p\n", &loc);
}

int main()
{
  auto x {1};
  auto y {2.3};
  f(x);
  f(y);
}

compile with g++ -std=c++14 dummy.cpp

Question:

For template functions, the type is explicitly mentioned(f<int>(2)) at compile time.

How does the function f accept arguments of different type?

1 Answers
Related