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

            Bug ID: 23932
           Summary: Assertion failed: ((!Initializer ||
                    isa<ImplicitValueInitExpr>(Initializer) ||
                    isa<CXXConstructExpr>(Initializer)) && "Initializer
                    expression that cannot have been implicitly
                    created."), function BuildCXXNew
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

Reduced test case:

// %clang_cc1 -emit-obj -fobjc-arc -Os -x objective-c++ %s
// REQUIRES: asserts

template <typename T> const id *f() { return new id; }
auto i = f<int>();

// template <typename T> const id *f() { new id[32]; return nullptr; }


With ARC, id needs to be value initialized.  The TreeTransform over the
template specialization will transform the ImplicitValueInitExpr into a
ParenListExpr, which breaks the initialization type check in BuildCXXNew.

The commented out test case is relevant as the single id case can be handled by
adding parenthesis to avoid setup the DirectInitRange value, while the same
workaround cannot be applied to the second case.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to