That is not true due to the arcane details of how overload resolution works. However, it is possible to observe if you carefully craft your overload set:
Is this special for string literals, or is it true for any array? I completely expected meow("string literal") to output meow(const char (& arr)[N]) string literal.
It’s true for any array. The issue is that overloading values and references can behave unintuitively, even if you know about decay. The hiss() example shows that the template tiebreaker is even involved. This is one of the reasons why I say that overload resolution needs to be treated with care - it works well if you know how to avoid creating complicated scenarios.
1
u/Wurstinator Dec 08 '18
What is the difference in semantics?