[llvm-bugs] [Bug 38106] New: Undefined reference error when "static const" variable is initialized in line (but works out of line)

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jul 9 08:12:30 PDT 2018


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

            Bug ID: 38106
           Summary: Undefined reference error when "static const" variable
                    is initialized in line (but works out of line)
           Product: clang
           Version: 6.0
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: albert.szilvasy at autodesk.com
                CC: llvm-bugs at lists.llvm.org

The following code demonstrates the issue.

#include <iostream>
class Foo
{
public:
    const static long long foo = 5;
    const long long* x = &foo;
};
//const long long Foo::foo = 5; // uncomment this and remove the initialization
in the class to make it link.
int main(int argc, const char * argv[]) {
    Foo foo;
    std::cout << *(foo.x) << std::endl;
    return 0;
}

Similar to https://bugs.llvm.org/show_bug.cgi?id=26006

-- 
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/20180709/f67c298d/attachment-0001.html>


More information about the llvm-bugs mailing list