[llvm-bugs] [Bug 40562] New: Possible miscompile with std::initializer_list after r274385

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Feb 1 08:39:08 PST 2019


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

            Bug ID: 40562
           Summary: Possible miscompile with std::initializer_list after
                    r274385
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: llvm at zaghen.it
                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

Testcase is this (also found at https://godbolt.org/z/iO4IL7 )

#include <initializer_list>

class T {
public:   
    int c;
    T(int c) : c(c) {}
};

extern void f(std::initializer_list<T>&);

void test() {
    T t(666);
    std::initializer_list<T> a({t});
    //std::initializer_list<T> a{{t}};
    f(a);
}

Something to note is that using the commented out version will work fine.
I think both versions should be OK as "t" will still be live until the end of
the scope.

-- 
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/20190201/f5a5efd7/attachment.html>


More information about the llvm-bugs mailing list