[Qt-interest] Weird compiler error with QString(QChar(value))
Gabriel M. Beddingfield
gabrbedd at gmail.com
Wed May 5 21:14:50 CEST 2010
On Wed, 5 May 2010, Nikos Chantziaras wrote:
> Not sure I understand why this won't compile:
>
> int unicodeValue = func_that_returns_a_unicode_value();
> QString s(QChar(unicodeValue));
> const QByteArray& utf8 = s.toUtf8(); // <-- error happens here
>
> I get:
>
> error: request for member 'toUtf8' in 's', which is of non-class type
> 'QString(QChar)'
I got:
error: request for member 'toUtf8' in 's', which is of non-class type 'QString ()(QChar)'
I can't explain it, but:
QString s = QString(QChar(unicodevalue));
works. Maybe the compiler things that 's' was function
declaration.
-gabriel
More information about the Qt-interest-old
mailing list