http://llvm.org/bugs/show_bug.cgi?id=21347

            Bug ID: 21347
           Summary: Assertion failed: (E &&
                    hasScalarEvaluationKind(E->getType()) && "Invalid
                    scalar expression to emit")
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

Objective-C++ ARC CodeGen seems incorrect.

Consider the following input:

typedef __SIZE_TYPE__ size_t;

namespace std {
template <typename _Ep>
class initializer_list {
  const _Ep *__begin_;
  size_t __size_;
  initializer_list(const _Ep *__b, size_t __size);
};
}

@interface NSObject
+ (instancetype) new;
@end

void function(std::initializer_list<NSObject *>);

void single() { function({ [NSObject new] }); }

void multiple() { function({ [NSObject new], [NSObject new] }); }

std::initializer_list<NSObject *> il = { [NSObject new] };

In all of these cases, the interesting bit is the intializer_list construction.
 The materialization will try to construct a NSObject * const __strong [1] or
NSObject * const __strong [2].  However, in CGExpr.cpp
CGF::EmitMaterializeTemporaryExpr, we explicitly call EmitScalarInit, thus
ending up trying to emit an aggregate as a scalar.  This triggers an assertion.

Handling that either by using EmitAggLValue or EmitAnyExprToMem (or better yet,
removing the special case), trigger a secondary assertion in
pushTemporaryCleanup which also seems bogus:
assert(!ObjCARCReferenceLifetimeType->isArrayType());

-- 
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