[cfe-dev] Compile errors when building kde-runtime
jediknil at belkadan.com
Mon May 7 18:16:27 PDT 2012
Are we smart enough to produce a fixit for this?
On May 7, 2012, at 19:44, Sean Silva wrote:
> 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 <http://en.wikipedia.org/wiki/Most_vexing_parse>.
> 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
More information about the cfe-dev