[Development] Compiler errors with clang 3.1
Olivier Goffart
olivier at woboq.com
Tue May 22 00:20:30 CEST 2012
On Monday 21 May 2012 18:01:22 Stephen Chu wrote:
> On 5/21/12 5:22 PM, Thiago Macieira wrote:
> > On segunda-feira, 21 de maio de 2012 17.07.51, Stephen Chu wrote:
> >> On 5/21/12 4:28 PM, Thiago Macieira wrote:
> >>> On sexta-feira, 18 de maio de 2012 16.56.09, Stephen Chu wrote:
> >>>> On the other hand, compiling using gcc 4.7 is successful. I am not sure
> >>>> if gcc is more lex on this or Q_DECL_CONSTEXPR macro is not defined.
> >>>
> >>> GCC seems to be more lax. I recommend providing us with fixes to make Qt
> >>> compile under that compiler.
> >>
> >> It looks to me that GCC is wrong on allowing it. I don't really know how
> >> to fix it but I will try.
> >>
> >> Does anyone know the purpose of declaring those functions constexpr?
> >
> > In most cases, the idea was to make the type be static-initialisable.
>
> I can't find any non-private use of this constructor:
>
> Q_DECL_CONSTEXPR inline QByteArray(QByteArrayDataPtr dd)
>
> : d(reinterpret_cast<Data *>(dd.ptr))
>
> {
> }
>
> And I don't think it can ever be made a constexpr.
It cannot.
QByteArray has a non-trivial destructor and is therefore not a literal type.
Hence QByteArray cannot be used in const expresstions
Class with an user defined destructor should not have constexpr constructor.
--
Olivier
Woboq - Qt services and support - http://woboq.com
More information about the Development
mailing list