Details
-
Technical task
-
Resolution: Done
-
P2: Important
-
None
-
Win7, Qt 32-bit, OpenGL, Visual Studio 2012
-
4ea581c95ae9704b250591c5d4d9b0517f5b62f2
Description
If I use a lambda in a constructor initializer list (not a C++ initializer list, like in QTBUG-34128), I get an error message "tr() cannot be called without context". I suspect this and QTBUG-34128 are a problem in lupdate's tokenizer routine looking for a "{" to start the constructor as the context but finding a brace when it didn't expect it.
Sample code:
// MyWidget inherits from QWidget MyWidget::MyWidget( QWidget* parent ) : QWidget( parent ) , _callback( []{ std::cout << "Hi\n"; } ) // Note the lambda , _translated1( tr( "Howdy" ) ) // "tr() cannot be called without context" { _translated2 = tr( "Hey" ); // "tr() cannot be called without context" }
Both of the tr calls here will generate messages from lupdate.