[llvm-bugs] [Bug 41241] New: clang complains about constexpr function in case for switch statement
    via llvm-bugs 
    llvm-bugs at lists.llvm.org
       
    Tue Mar 26 08:42:38 PDT 2019
    
    
  
https://bugs.llvm.org/show_bug.cgi?id=41241
            Bug ID: 41241
           Summary: clang complains about constexpr function in case for
                    switch statement
           Product: new-bugs
           Version: 8.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: mkmostafa92 at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org
struct X
        {
        enum class E
        {
            A,B
        };
        static constexpr X A()
        {
            return X{E::A};
        }
        static constexpr X B()
        {
            return X{E::B};
        }
        constexpr operator E() const
        {
            return a;
        }
        E a;
    };
    template <typename T>
    struct Y
    {
        void f()
        {
            // without this line clang errs
            // const auto & x = this->x;
            switch(x)
            {
                case X::A():
                case X::B():
                default: return;
            }
        }
        X x = X::A();
    };
    int main()
    {
        Y<int>{}.f();
    }
the previous code sample does not compile without the commented line or simply
adding this->x to the switch condition
-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190326/58bcced6/attachment-0001.html>
    
    
More information about the llvm-bugs
mailing list