[cfe-dev] Issues with vector initialization using parentheses

Magee, Josh Joshua.Magee at am.sony.com
Tue Sep 4 16:42:15 PDT 2012

At 1346383775 seconds past the Epoch, Eli Friedman wrote:
> On Thu, Aug 30, 2012 at 7:12 PM, Magee, Josh <Joshua.Magee at am.sony.com> wrote:
> > Hi,
> >
> > I noticed some issues with vector initialization using parentheses.
> >
> > Consulting the Clang documentation: http://clang.llvm.org/docs/LanguageExtensions.html#vectors
> > See the following paragraph on Vector Literals:
> > "Vector literals can be used to create vectors from a set of scalars, or
> > vectors. Either parentheses or braces form can be used. In the parentheses form
> > the number of literal values specified must be one, i.e. referring to a scalar
> > value, or must match the size of the vector type being created. If a single
> > scalar literal value is specified, the scalar literal value will be replicated
> > to all the components of the vector type. In the brackets form any number of
> > literals can be specified."
> The docs here are incomplete; parentheses only work when either
> AltiVec or OpenCL is enabled.  Otherwise, you're just getting plain C
> semantics for commas.
> -Eli

Ahh, I understand - thanks for clarifying.  What do you think about
adding AltiVec or OpenCL semantics for parentheses initialization to
extended vector types in general (i.e., when neither AltiVec nor
OpenCL is enabled)?

Are there reasons against doing this or would it fall into the
"patches welcome" category?


More information about the cfe-dev mailing list