[cfe-dev] Clang: QT header compilation error

Matthieu Monrocq matthieu.monrocq at gmail.com
Mon Nov 19 10:10:05 PST 2012


On Mon, Nov 19, 2012 at 2:08 PM, Dmitri Gribenko <gribozavr at gmail.com>wrote:

> On Mon, Nov 19, 2012 at 3:02 PM, Sujit Kamthe
> <Sujit.Kamthe at kpitcummins.com> wrote:
> >
> > Hi,
> >
> > While I was running clang on a QT code, It flagged a compilation error in
> > a standard QT header file.
> >
> > include\QtCore/qvector.h:565:12: error: missing 'typename'
> >
> >       prior to dependent type name 'QVector<T>::iterator'
> >
> > Q_TYPENAME QVector<T>::iterator QVector<T>::insert(iterator before,...
> >
> >            ^~~~~~~~~~~~~~~~~~~~
> >
> > include\QtCore/qvector.h:599:12: error: missing 'typename'
> >
> >       prior to dependent type name 'QVector<T>::iterator'
> >
> > Q_TYPENAME QVector<T>::iterator QVector<T>::erase(iterator abegin,...
> >
> >            ^~~~~~~~~~~~~~~~~~~~
> >
> >
> >
> > Attaching the header file along.
>
> Hi Sujit,
>
> Unfortunately, the header file alone is not helpful.  It is not
> obvious what Q_TYPENAME expands to.  Could you please provide a
> preprocessed file?  (Just replace -c with -E on the compilation
> command line that is failing.)
>
> Dmitri
>
> --
> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>

At a glance (given the diagnostic and the macro) I suppose that Q_TYPENAME
should have expanded into typename (which would have made the code correct)
and did not.

As such, the preprocessed source will only be of moderate usefulness
(confirming the diagnosis) and we will also need the definition of this
Q_TYPENAME macro. It's probably defined differently depending on the
platform and mistake clang for a non-compliant compiler.

-- Matthieu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121119/f56ecf10/attachment.html>


More information about the cfe-dev mailing list