In the following two template functions, one tries to be more constrained:
template<typename T>
concept SmallVar = (sizeof(T) <= sizeof(int));
void print(SmallVar auto t) { // 1
std::cout << t << std::endl;
}
void print(const auto& t) { // 2
std::cout << t << std::endl;
}
When called with an int, Clang and GCC differ:
int main() {
print(6); // clang accepts and prefers 1, gcc sees here ambiguity
}
Which one is right?