On sexta-feira, 6 de julho de 2012 13.22.38, Stephen Chu wrote:
> On 7/6/12 12:19 PM, Thiago Macieira wrote:
> > On sexta-feira, 6 de julho de 2012 18.12.10, Olivier Goffart wrote:
> >> #if defined(Q_COMPILER_CONSTEXPR) && defined(Q_COMPILER_DEFAULT_MEMBERS)
> >> &&
> >> defined(Q_COMPILER_DELETE_MEMBERS)
> >>
> >> fixes the problem for me.
> >> So it should be disabled for those broken version of clang.
> >
> > Looks like a compiler bug for me, or we forgot one Q_COMPILER macro. We
> > might
> So this error is caused by bugs in Clang 3.1?

I don't know. I need someone who has the compiler to test that it's
implementing the features correctly.

> > need to introduce Q_COMPILER_UNIFORM_INITIALIZATION.
>
> Isn't that Q_COMPILER_INITIALIZER_LISTS?

No.

Uniform initialisation is like this:

struct Foo
{
        Foo(int, const char *);
};

Foo f = { 1, "hello" };


ICC:
Line 6: error: initialization with "{...}" is not allowed for object of type
"Foo"
  Foo f = { 1, "hello" };
          ^

Clang 3.0:
<stdin>:6:5: error: non-aggregate type 'Foo' cannot be initialized with an
initializer list
Foo f = { 1, "hello" };
    ^   ~~~~~~~~~~~~~~

If I remove the equal sign, GCC still compiles and Clang produces the same
error message, but ICC says:
Line 6: error: no default constructor exists for class "Foo"
  Foo f { 1, "hello" };
      ^

Line 6: error: expected a ";"
  Foo f { 1, "hello" };
        ^

So Clang seems to support the feature partially, but will not call the
constructor.
--
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
     Intel Sweden AB - Registration Number: 556189-6027
     Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to