Issue 60929
Summary Clang is unable to match calls to functions with a std::initializer_list when modules are enabled and a class with a virtual destructor is defined before #include <initializer_list>
Labels libc++, clang:frontend, clang:modules
Assignees
Reporter alanzhao1
    I have commit b673135bb833a54b16c32e2073d2d7b83c90de66 checked out

Repro steps:

1. Build and install libc++:
```
$ cmake -G Ninja -B build -S runtimes -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" -DLIBCXX_ABI_UNSTABLE=On
$ cd build
$ ninja cxx cxxabi unwind
$ ninja install-cxx install-cxxabi install-unwind
```

2. Build clang
3. Attempt to compile the following file against the aforementioned installed libc++
```cpp
// initlist_test.cc
class X {
 public:
  virtual ~X() {}
};

#include <initializer_list>

void takesil(std::initializer_list<int> il) {}

void passesil() { takesil({1}); }

```

```
$ /path/to/built/clang++ -nostdinc++ -isystem/path/to/installed/clang/include/c++/v1 -fmodules -fbuiltin-module-map -fmodule-map-file=/path/to/installed/clang/include/c++/v1/module.modulemap -c -o initlist_test.cc initlist_test
```

Expected result:

clang should compile the file without any errors

Actual result:

clang fails to match the call to `takesil(...)` in `passesil()`:

```
initlist_test.cc:11:19: error: no matching function for call to 'takesil'
void passesil() { takesil({1});}
 ^~~~~~~
initlist_test.cc:9:6: note: candidate function not viable: cannot convert initializer list argument to 'std::initializer_list<int>'
void takesil(std::initializer_list<int> il) {}
     ^
1 error generated.
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to