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

**URL:** <https://forum.juce.com/t/bug-ambiguous-operator-string-std-string/27877>\
**Category:** General JUCE discussion\
**Created:** [May 26, 2018, 3:41pm UTC](https://forum.juce.com/t/bug-ambiguous-operator-string-std-string/27877 "2018-05-26T15:41:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![PixelPacker](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/pixelpacker/32/9869_2.png) [@PixelPacker](https://forum.juce.com/u/PixelPacker)\
**Post date:** [May 26, 2018, 3:41pm UTC](https://forum.juce.com/t/bug-ambiguous-operator-string-std-string/27877/1 "2018-05-26T15:41:05Z")

</div>

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

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

```

Cheers,  
Ben

---

<div class="post-metadata">

**Author:** ![mcmartin](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/mcmartin/32/7432_2.png) [@mcmartin](https://forum.juce.com/u/mcmartin)\
**Post date:** [May 27, 2018, 1:57pm UTC](https://forum.juce.com/t/bug-ambiguous-operator-string-std-string/27877/2 "2018-05-27T13:57:05Z")

</div>

@jules added an explicit overload to `operator+` in [https://github.com/WeAreROLI/JUCE/commit/4793cd3fb8efd0ea4680ef4a86e4a37c2b1c9c96](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
auto x = String{std::string{}} + String{};

```

or

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

```
