[LLVMbugs] [Bug 22637] New: const member function in templated "union-like" class treats non-static member as non-const

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Feb 19 15:44:41 PST 2015


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

            Bug ID: 22637
           Summary: const member function in templated "union-like" class
                    treats non-static member as non-const
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hs at xmission.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

// snippet tested on clang HEAD 3.7.0 (trunk 229861) (llvm/trunk 229855)

#include <iostream>

void check(int&) { std::cout << "non-const "; }
void check(int const&) { std::cout << "const "; }

template <typename> 
struct A { 
    union { 
        int b; 
    };

    int c;    
    void foo() const { check(b); check(c); } 
};

int main(){ 
    A<int> a; 
    a.foo(); 
} 

// output: non-const const

-- 
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/20150219/4e5406b7/attachment.html>


More information about the llvm-bugs mailing list