Allow initializing a vector with a vector in addition to allowing a list
of the elements. Issue reported on cfe-dev by Mattias Holm. llvm-svn: 73292
This commit is contained in:
parent
185c9ef0a2
commit
9782caa369
|
@ -674,7 +674,7 @@ void InitListChecker::CheckSubElementType(InitListExpr *IList,
|
|||
// compatible structure or union type. In the latter case, the
|
||||
// initial value of the object, including unnamed members, is
|
||||
// that of the expression.
|
||||
if (ElemType->isRecordType() &&
|
||||
if ((ElemType->isRecordType() || ElemType->isVectorType()) &&
|
||||
SemaRef.Context.hasSameUnqualifiedType(expr->getType(), ElemType)) {
|
||||
UpdateStructuredListElement(StructuredList, StructuredIndex, expr);
|
||||
++Index;
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
// RUN: clang-cc -fsyntax-only -verify %s
|
||||
|
||||
typedef float __attribute__((vector_size (16))) v4f_t;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
float x, y, z, w;
|
||||
}s;
|
||||
v4f_t v;
|
||||
} vector_t;
|
||||
|
||||
|
||||
vector_t foo(v4f_t p)
|
||||
{
|
||||
vector_t v = {.v = p};
|
||||
return v;
|
||||
}
|
Loading…
Reference in New Issue