[LLVMbugs] [Bug 2704] New: Constructor-style initialization of bool fails

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu Aug 21 15:13:21 PDT 2008


http://llvm.org/bugs/show_bug.cgi?id=2704

           Summary: Constructor-style initialization of bool fails
           Product: clang
           Version: unspecified
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: parser
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: michel.boto at gmail.com
                CC: llvmbugs at cs.uiuc.edu


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.


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list