Bug: Ambiguous operator String() + std::string()

this used to work and was introduced quite recently. reproduction:

auto x = std::string() + String();


@jules added an explicit overload to operator+ in https://github.com/WeAreROLI/JUCE/commit/4793cd3fb8efd0ea4680ef4a86e4a37c2b1c9c96.

@pixelpacker what do you expect x to be in your example? A juce::String or a std::string?

To be explicit (and avoid the ambiguity), you can re-write your example as:

auto x = String{std::string{}} + String{};


auto x = std::string{} + String{}.toStdString();
1 Like