[LLVMbugs] [Bug 7194] New: Possible bug when combining functions returning const enum and the conditional operator?

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri May 21 18:14:06 PDT 2010


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

           Summary: Possible bug when combining functions returning const
                    enum and the conditional operator?
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: funkytune84 at hotmail.com
                CC: llvmbugs at cs.uiuc.edu


The following code compiles in g++, but gives an error in clang++. If the two
'const' specifiers are removed, it works in clang++ as well.


enum My_Enum
{
    A, B
};

const My_Enum Get_A()
{
    return A;
}

int main( int argc, char **argv )
{
    const My_Enum result = true ? Get_A() : B;

    return 0;
}

error: cannot initialize a variable of type 'My_Enum const' with an rvalue of
type 'int'
        const My_Enum result = true ? Get_A() : B;
                      ^        ~~~~~~~~~~~~~~~~~~

-- 
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