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: unassignedclangb...@nondot.org
          Reporter: l...@zaghen.it
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to