<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/61332>61332</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Confusing/wrong "error cannot form a reference to 'void'" with initializer list/struct initialization/libc++
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          aeubanks
      </td>
    </tr>
</table>

<pre>
    ```
// a.cc
#include <string>
#include <vector>

struct CriterionInfo {
  int criterion_id = 0;
 std::string parameters;
};

void DoSomething(const CriterionInfo& info) {}

void DoSomething(const std::vector<CriterionInfo>& infa) {}

void foo() {
  DoSomething({{.criterion_id = 1001}, {.criterion_id = 1002}});
}

int main() {
  foo();
}

# ToT clang
$ clang -fsyntax-only a.cc # using libstdc++
# no error
$ clang -fsyntax-only a.cc -stdlib=libc++
In file included from /tmp/a.cc:1:
/usr/local/google/home/aeubanks/repos/llvm-project2/build/rel/bin/../include/c++/v1/string:656:31: error: cannot form a reference to 'void'
      is_convertible<const _Tp&, basic_string_view<_CharT, _Traits> >::value &&
 ^
/usr/local/google/home/aeubanks/repos/llvm-project2/build/rel/bin/../include/c++/v1/string:973:35: note: in instantiation of template class 'std::__can_be_converted_to_string_view<char, std::char_traits<char>, void>' requested here
            class = __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
 ^
/usr/local/google/home/aeubanks/repos/llvm-project2/build/rel/bin/../include/c++/v1/string:975:93: note: in instantiation of default argument for 'basic_string<void>' required here
  _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit basic_string(
 ^~~~~~~~~~~~~
/tmp/a.cc:14:40: note: while substituting deduced template arguments into function template 'basic_string' [with _Tp = void, $1 = (no value)]
  DoSomething({{.criterion_id = 1001}, {.criterion_id = 1002}});
                                       ^
1 error generated.
```

not sure if this is a libc++ or clang issue...
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzUVkFv4zYT_TX0ZRBDIm3LPvjgyBY-A7vZ4ItQ7E2gqJHNliZdkkp2e-hvL0hZSux025yKljBEmUMOR2_ePJI7Jw8acU3m92S-nfDOH41dc-xqrn9xk9o039dkkVx-yZYkG0ILQgvgUyGGASa1UF2DQFjuvJX6QNjuz4zPKLyxr8b4dN52wkNupUcrjd7r1gDJ7nsrgNQexGCsZAOEbSEhbJjgfEPYhrBNvzWcueUn9GjdOIdk29f3-Hw2soGteTIn9McQMF0Ko91NGIQuQMZ-FSPKth_yMUY0fG9-7ZXtLo75XzhujSF0OUy4YHG9W1x5P30HTpokaXBJc_iRnQZ7mLK6AulNEAH2E5f6fRBjZD9aSiiD0pQgFNeHYWjW_4W71n3Xnn-7M1p9jzSCML9zIXdK1s43gtD78BudaQNorbEf8HXnfKNkTdhWyfrK0V5DKxXChY8NtNacgNDCn86EFpHQbJOGzA1E75wltFBGcEVocTDmoJDQ4mhOoRvKhNDC4tmEXqnn093Zmp9ReEpoUXdSNdEeHNQBzWI6JbS4BEFoMcRIi-eU0GKon81iviBsw0I8l49nGxBca-OhNfYEHCy2aFELBG-A0CzwhtBsyFNo0lXC6Ge0XtYKCct7hlblmdBFIEjNnRRVv2v1LPGFsLzKj9yWwVqVlkvvCNtBYG1Paq46hLh8cdmKzHf_CsxWGQuYzQNU2ngMvdQgtfNce8m9NBpMCx5PZ8U9Bho5F6AbS7aqBNdVjQNs2FTe3OAjjtwGdMZFYaDyF6h6c6jxHGJGwmsGFn_t0Hls4IgW3-aob5dQ2BaqCjWvFVayrXxIxwdCep-y-Hr-b2QtJGzF_i5rDba8Ux64PXQn1LEMQu7eUjgcMteYS3sDefVpf58_Plafd-X_vmyrcvf58dOm3FX7z4-f9vm-rPYPT-Xmodxvyv2Xh-qn_dO4JP_y8FTuvj7-v3raP-S7Kv_6lSaA385KCumv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