Confirm QLatin1StringView can be constructed over arrays of unknown bounds
It can (unlike the other views). Pick-to: 6.9 6.8 6.5 5.15 Task-number: QTBUG-112746 Change-Id: Id976429611c53f1c707de1d989c454507b8f4773 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
This commit is contained in:
parent
3dc28cfae9
commit
01f0305dc6
@ -14,11 +14,24 @@ Q_DECLARE_TYPEINFO(QLatin1StringViewContainer, Q_RELOCATABLE_TYPE);
|
||||
QT_END_NAMESPACE
|
||||
Q_DECLARE_METATYPE(QLatin1StringViewContainer)
|
||||
|
||||
// QTBUG-112746
|
||||
namespace {
|
||||
extern const char string_array[];
|
||||
static void from_array_of_unknown_size()
|
||||
{
|
||||
auto sv = QLatin1StringView{string_array};
|
||||
QCOMPARE(sv.size(), 3);
|
||||
}
|
||||
const char string_array[] = "abc\0def";
|
||||
|
||||
} // unnamed namespace
|
||||
|
||||
class tst_QLatin1StringView : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private Q_SLOTS:
|
||||
void fromArraysOfUnknownSize() { from_array_of_unknown_size(); }
|
||||
void constExpr();
|
||||
void construction();
|
||||
void userDefinedLiterals();
|
||||
|
Loading…
x
Reference in New Issue
Block a user