<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Clang produces less useful error message when explicit constructor invoked implicitly"
   href="https://bugs.llvm.org/show_bug.cgi?id=34744">34744</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang produces less useful error message when explicit constructor invoked implicitly
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>csaba_22@yahoo.co.uk
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>$ clang -v
clang version 5.0.0 (trunk 308427)

$ cat errmsg.cpp
#include <string>
#include <map>

namespace a {
    struct AV {
        explicit AV(std::string const&);
    };
    // ---

    struct EAV;

    typedef std::map<std::string, EAV> EAM;

    struct EAV {
        explicit EAV(AV const&);
    };

    // ---

    struct UIRQ {
        typedef EAM ET;

        ET const& expected() const;

        UIRQ & expected(ET const&);
    };
}

int main()
{
    a::UIRQ req;
    req.expected({ {"kye", a::AV{ "valu" } } });
}

/* GCC 8
errmsg.cpp: In function ‘int main()’:
errmsg.cpp:32:47: error: converting to ‘std::pair<const
std::basic_string<char>, a::EAV>’ from initializer list would use explicit
constructor ‘constexpr std::pair<_T1, _T2>::pair(_U1&&, _U2&&) [with _U1 =
const char (&)[4]; _U2 = a::AV; typename std::enable_if<(std::_PCC<true, _T1,
_T2>::_MoveConstructiblePair<_U1, _U2>() && (! std::_PCC<true, _T1,
_T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> =
0; _T1 = const std::basic_string<char>; _T2 = a::EAV]’
     req.expected({ {"kye", a::AV{ "valu" } } });
                                               ^
*/

/* clang 5.0.0
errmsg.cpp:32:9: error: no matching member function for call to 'expected'
    req.expected({ {"kye", a::AV{ "valu" } } });
    ~~~~^~~~~~~~
errmsg.cpp:25:16: note: candidate function not viable: cannot convert
initializer list argument to 'const a::UIRQ::ET' (aka 'const
map<basic_string<char>, a::EAV>')
        UIRQ & expected(ET const&);
               ^
errmsg.cpp:23:19: note: candidate function not viable: requires 0 arguments,
but 1 was provided
        ET const& expected() const;
                  ^

*/

The GCC error message mentions a hint to the problem (EAV constructor is
explicit). Clang's error message makes no mention of 'explicit'.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>