[LLVMbugs] [Bug 19602] New: Bad diagnostic when wrong type passed to initializer list

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Apr 29 09:13:20 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=19602

            Bug ID: 19602
           Summary: Bad diagnostic when wrong type passed to initializer
                    list
           Product: clang
           Version: 3.4
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: sidney at s4y.us
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 12453
  --> http://llvm.org/bugs/attachment.cgi?id=12453&action=edit
Test case

When I compile the test case (which initializes a container with an initializer
list of `const char*`s who expects a type which can only be constructed from
`std::string`s), I get this error:

```
test.cpp:15:28: error: no matching constructor for initialization of
      'container<const thing>'
    container<const thing> c{
                           ^~
test.cpp:10:5: note: candidate constructor not viable: requires 1 argument, but
      3 were provided
    container(std::initializer_list<T>) {}
    ^
test.cpp:9:8: note: candidate constructor (the implicit copy constructor) not
      viable: requires 1 argument, but 3 were provided
struct container {
       ^
test.cpp:9:8: note: candidate constructor (the implicit move constructor) not
      viable: requires 1 argument, but 3 were provided
1 error generated.
```

The errors imply that matching failed because the wrong number of arguments
were passed to the constructor, which is misleading.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140429/5a2ebeff/attachment.html>


More information about the llvm-bugs mailing list