[llvm-bugs] [Bug 50559] New: Wrong initialization performed with empty initializer list

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jun 2 03:17:51 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=50559

            Bug ID: 50559
           Summary: Wrong initialization performed with empty initializer
                    list
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: lewko.krzys at gmail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Given code below:
```
struct S {
  S(std::initializer_list<double>); // #1
  S(std::initializer_list<int>);    // #2
  S();                              // #3
  // ...
};
int main() {
  S s1 = {}; // invoked #3
  s1 = {}; // should invoke #3 again, but tries to invoke #1 or #2 and call is
ambigious.
}
```

Code is tried to be miscompiled, `s1` should be value initialized due to empty
initializer list assignment.

-- 
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/20210602/d9ef663d/attachment.html>


More information about the llvm-bugs mailing list