[Development] Using Qt 5 with C++11/Clang 3.1?
Thiago Macieira
thiago.macieira at intel.com
Fri Jul 6 20:25:39 CEST 2012
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120706/f60e8716/attachment.sig>
More information about the Development
mailing list