mardi 2 août 2016

Why is decltype(a, b) is evaluated to a reference?

According to this answer, ref should be an int.

But for some reason it evaluated to int&, both in gcc and MSVC2015, while decltype(b) is correctly evaluated to just int. Why so?

int a = 1, b = 2;
decltype(a, b) ref; // ref is int&
decltype(b) var;    // var is int

Aucun commentaire:

Enregistrer un commentaire