Reply to comment

"using namespace std" and c++11 lambdas don't work?

On MacOSX 10.6.8, on on llvm/clang svn r150068; on cling svn r43013, with the patch below to cling/lib/Interpreter/DynamicLookup.cpp:419 to get compilation, I'm getting a crash when I do "using namespace std".
$ ./cling
**** Welcome to the cling prototype! ****
* Type C code and press enter to run it *
* Type .q, exit or ctrl+D to quit       *
*****************************************
[cling]$ #include iostream   // NB: the html wouldnt let me send angle brackets around iostream, but they were there!
[cling]$ using namespace std;
Declaration name has no FETokenInfo
UNREACHABLE executed at DeclarationName.cpp:339!
Illegal instruction

$ cd ~/pkg/llvm-post-3.0-svn/llvm/tools/cling/lib/Interpreter

# patch previously mentioned... to get compilation.
$ svn diff
Index: DynamicLookup.cpp
===================================================================
--- DynamicLookup.cpp	(revision 43039)
+++ DynamicLookup.cpp	(working copy)
@@ -416,7 +416,7 @@
           // resolution of the constructors and then initializes the new
           // variable with it
 	  ExprResult InitExprResult 
-	    = m_Sema->ActOnParenListExpr(m_NoSLoc,
+	    = m_Sema->ActOnParenOrParenListExpr(m_NoSLoc,
 					 m_NoELoc,
 					 move_arg(Inits));
           m_Sema->AddInitializerToDecl(HandlerInstance,


...also the C++11 lambda feature doesn't seem to work; any clue why? (see below for example)

Thanks!

Jason

$  ./cling -Wc++11-extensions

**** Welcome to the cling prototype! ****
* Type C code and press enter to run it *
* Type .q, exit or ctrl+D to quit       *
*****************************************
[cling]$ #include 
[cling]$ using std::cout
[cling]$ auto func = [] () { cout << "Hello world"; };
input_line_6:2:2: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
 auto func = [] () { cout << "Hello world"; };
 ^
input_line_6:2:14: error: expected expression
 auto func = [] () { cout << "Hello world"; };
             ^
[cling]$ 

Reply

The content of this field is kept private and will not be shown publicly.