https://llvm.org/bugs/show_bug.cgi?id=28425

            Bug ID: 28425
           Summary: Compile failure with enum and ternary operator
           Product: clang
           Version: 3.8
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangb...@nondot.org
          Reporter: peter.klot...@gmail.com
                CC: dgre...@apple.com, llvm-bugs@lists.llvm.org
    Classification: Unclassified

Created attachment 16693
  --> https://llvm.org/bugs/attachment.cgi?id=16693&action=edit
Program that demonstrates the behavior

clang fails to compile the attached (rather simple) C++ program.

[user@host test]$ clang++ -Wall -Wextra -c clang_error.cpp
clang_error.cpp:11:28: error: cannot initialize a variable of type 'const
PermissionTypePk' with an rvalue of type 'int'
    const PermissionTypePk permissionTypePk = true ?
PermissionType::getPermissionType().m_pk : PT_GLOBAL;
                           ^                 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

Removing "const" from member "m_pk" makes the program compile.

gcc 6 compiles both versions, with and without "const".

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to