[cfe-dev] Compile errors when building kde-runtime

Sean Silva silvas at purdue.edu
Mon May 7 16:44:13 PDT 2012

It looks like its the usual "most vexing parse", with an astonishing
cascade of diagnostics caused by it.

It's a regrettable quirk of C++'s syntax, even has its own wikipedia page <

Basically, this is the problem:

warning: parentheses were disambiguated as a function declarator
   Soprano::Node dateTime( Soprano::LiteralValue(
QDateTime::currentDateTime() )

Clang sums it up quite nicely. That declaration declares a function
`dateTime`, which is causing all the problems (failure to find overloads,
etc.). An extra pair of parens should make the program mean what you
intended (unless there's something else going on that I missed among the
cascade of errors):

Soprano::Node dateTime( Soprano::LiteralValue(QDateTime::currentDateTime() )
Soprano::Node dateTime( (Soprano::LiteralValue(QDateTime::currentDateTime())

This is one reason why C++11's "uniform initialization syntax" is a win. It
avoids this problem by using braces.

--Sean Silva

On Fri, May 4, 2012 at 6:06 PM, Shaun Reich <sreich at kde.org> wrote:

> reproducible with clang from today's git.
> --
> Shaun Reich,
> KDE Software Developer (kde.org)
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120507/e0d819fa/attachment.html>

More information about the cfe-dev mailing list