[LLVMbugs] [Bug 18696] New: Missing symbol at link time for constexpr class const static member if they are arrays.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Feb 2 06:40:52 PST 2014


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

            Bug ID: 18696
           Summary: Missing symbol at link time for constexpr class const
                    static member if they are arrays.
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: galopin at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The following sample do not link, s_ is missing at link time. 

=================================
#include <iostream>

struct Foo {
    constexpr int operator()(int v) const { return v+s_[0]; }
    void notok( std::ostream & os ) const {
        os << s_[0] << std::endl;
    }
    static constexpr int const s_[]{ 3 };
};

int main() {
    constexpr Foo const bar{};

    constexpr auto const ok = bar(10);
    std::cout << ok << std::endl;
    bar.notok( std::cout );
}
=================================

If s_ is not an array type, the sample link correctly

=================================
#include <iostream>

struct Foo {
    constexpr int operator()(int a) const { return a+s_; }
    void notok( std::ostream & os ) const {
        os << s_ << std::endl;
    }
    static constexpr int const s_{ 3 };
};

int main() {
    constexpr Foo const bar{};

    constexpr auto const ok = bar(10);
    std::cout << ok << std::endl;
    bar.notok( std::cout );
}
=================================

-- 
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/20140202/47240c6b/attachment.html>


More information about the llvm-bugs mailing list