Please explain a gcc weirdness

Stefan Majewsky kdemailinglists at bethselamin.de
Wed Jun 23 21:51:30 BST 2010


On Wednesday 23 June 2010 21:28:09 Sebastian TrĂ¼g wrote:
> Why does the following code fail with gcc 4.3.4:
> 
> QString uri...;
> Nepomuk::Resource res( KUrl( uri ) );
> 
> while this works:
> 
> KUrl resourceUri( uri );
> Nepomuk::Resource res( resourceUri );
> 
> And by "fail" I mean that gcc does not recognize res as being of type
> Nepomuk::Resource.
> 
> I would simply like to understand this.

IMO g++ thinks that "Nepomuk::Resource res(KUrl(uri));" is a declaration of 
"res" as a function variable of type "Nepomuk::Resource(KUrl(uri))".

Again IMO, "Nepomuk::Resource res((KUrl(uri)));" should do what you want.

That's why programming language designers will always insist that undecidable 
grammar is bad.

Greetings
Stefan




More information about the kde-core-devel mailing list