Constructor-style initialization of bool fails
| Bugzilla Link | 2704 |
| Resolution | FIXED |
| Resolved on | Mar 12, 2010 00:56 |
| Version | unspecified |
| OS | MacOS X |
| Reporter | LLVM Bugzilla Contributor |
| CC | @akyrtzi |
Extended Description
Despite the C++ status page saying boolean is fully supported, when running a pretty simple test just to try out the AST generation, it seems like ctor initializing native types confuses the parser (and subsequently the AST).
The line
bool b(true);
causes an error in ParseDecl.cpp on line 1366 (as of rev. 55139).
Here is the original code:
// test constructor-style initialization of PODs int main() { bool b(true); return 0; }
and here is the output from clang:
/Users/mike/Code/asttests/shunt.cpp:3:9: error: expected parameter declarator bool b(true); ^ /Users/mike/Code/asttests/shunt.cpp:3:9: error: expected ')' /Users/mike/Code/asttests/shunt.cpp:3:8: error: to match this '(' bool b(true); ^
int main() (CompoundStmt 0xc08030 </Users/mike/Code/asttests/shunt.cpp:2:12, line:5:1> (DeclStmt 0xc07fc0 line:3:2 0xc07f80 "_Bool (b)(void)" (ReturnStmt 0xc07d80 <line:4:2, col:9> (IntegerLiteral 0xc07fe0 col:9 'int' 0)))
3 diagnostics generated.
This has now been fixed (rev. 57178).
This is because constructor style inits aren't supported yet. :)