diff options
author | Liang Qi <liang.qi@qt.io> | 2016-05-27 11:34:20 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-05-27 11:34:25 +0200 |
commit | 1d0a02f8a227286dbc383f890a1fd61e9139c223 (patch) | |
tree | 9780d50e500af6f6291d64f2e09431faa6f1fa13 | |
parent | 9eb5086aebc7dd01a444778d0885cc1959e4a901 (diff) | |
parent | abcb49adcc640817b37d4ba8f0c10712a857d434 (diff) |
Merge remote-tracking branch 'origin/5.6.1' into 5.7.0v5.7.0-rc1
Change-Id: I776e0503279ee3ca7726459c97056a92dcfbdaa4
-rw-r--r-- | src/linguist/lupdate/cpp.cpp | 8 | ||||
-rw-r--r-- | tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp | 17 | ||||
-rw-r--r-- | tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result | 8 |
3 files changed, 29 insertions, 4 deletions
diff --git a/src/linguist/lupdate/cpp.cpp b/src/linguist/lupdate/cpp.cpp index 02a667320..e53994c76 100644 --- a/src/linguist/lupdate/cpp.cpp +++ b/src/linguist/lupdate/cpp.cpp @@ -1848,16 +1848,16 @@ void CppParser::parseInternal(ConversionData &cd, const QStringList &includeStac } } - if (yyTok == Tok_Colon) { - // Skip any token until '{' since we might do things wrong if we find - // a '::' token here. + if (yyTok == Tok_Colon || yyTok == Tok_Other) { + // Skip any token until '{' or ';' since we might do things wrong if we find + // a '::' or ':' token here. do { yyTok = getToken(); if (yyTok == Tok_Eof) goto goteof; if (yyTok == Tok_Cancel) goto case_default; - } while (yyTok != Tok_LeftBrace); + } while (yyTok != Tok_LeftBrace && yyTok != Tok_Semicolon); } else { if (yyTok != Tok_LeftBrace) { // Obviously a forward declaration. We skip those, as they diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp index 5b6645689..e6b966418 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp @@ -627,3 +627,20 @@ TemplateClass::TemplateClass(int) : tr("[unsupported] TemplateClass(int) out-of-class body"); } + + +// Related to QTBUG-53644, adapted from qglobal.h. +// Namespace Private must be parsed correctly for TranslatedAfterPrivate to work. +namespace Private { + template <class T> struct Class1 { T t; }; + template <class T> struct Class1<T &> : Class1<T> {}; + template <class T> struct Class2 { enum { Value = sizeof(T) }; }; +} // namespace Private +class TranslatedAfterPrivate +{ + Q_OBJECT + TranslatedAfterPrivate() + { + tr("Must be in context TranslatedAfterPrivate"); + } +}; diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result index d72026b1c..e0a30c3be 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result @@ -555,6 +555,14 @@ backslashed \ stuff.</source> </message> </context> <context> + <name>TranslatedAfterPrivate</name> + <message> + <location filename="main.cpp" line="644"/> + <source>Must be in context TranslatedAfterPrivate</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> <name>YetAnotherTest</name> <message> <location filename="main.cpp" line="239"/> |