Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.0.0
-
None
-
Vista SP2,MSVC2010
-
f3f60743551936e3d06f7f5c8bb2c76eab6d536c
Description
QStringLiteral has several problems on msvc2010
I.
// ok QString s = QLatin1String( "hello" "world"); // fail QString t = QStringLiteral( "hello" "world");
.\main.cpp(27) : error C2308: concatenating mismatched strings
Concatenating wide "hello" with narrow "world"
.\main.cpp(27) : error C2308: concatenating mismatched strings
Concatenating wide "hello" with narrow "world"
.\main.cpp(27) : error C2308: concatenating mismatched strings
Concatenating wide "hello" with narrow "world"
.\main.cpp(27) : error C2308: concatenating mismatched strings
Concatenating wide "hello" with narrow "world"
mainwindow.cpp
There is known workaround, use
QStringLiteral("\ hello\ cruel\ world");
instead;
II.
QString names[] = { QStringLiteral("hello"), QStringLiteral("world") };
in global scope it fails with:
.\main.cpp(12) : fatal error C1506: unrecoverable block scoping error
in local scope it fails with an internal compiler error.
III.
template <typename T> struct MyTrait { static QString name; }; template <> QString MyTrait<int>::name = QStringLiteral("int");
.\main.cpp(10) : error C2332: 'enum' : missing tag name
.\main.cpp(10) : error C2065: 'Size' : undeclared identifier
.\main.cpp(10) : error C2552: 'qstring_literal' : non-aggregates cannot be initi
alized with initializer list
'QStaticStringData' : Types with user defined constructors are not aggre
gate
.\main.cpp(10) : error C2078: too many initializers
.\main.cpp(10) : error C2065: 'Size' : undeclared identifier