[LLVMbugs] [Bug 15858] New: Non-type parameter link failure

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Apr 27 12:31:46 PDT 2013


            Bug ID: 15858
           Summary: Non-type parameter link failure
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: kjw.chiu at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

When using decltype on a function pointer template parameter to define
a data member, it seems to generate an incorrect external reference.
This code:

    template <typename R, typename P, R F(P)>
    struct B {
        B() { v = F; }
        decltype(F) v;

    void foo(int) {}

    int main() {
        B<void, int, &foo> o;

results in this error:

    $ clang++ --version
    clang version 3.3 (trunk 180631)
    Target: x86_64-unknown-linux-gnu
    Thread model: posix
    $ clang++ -std=c++11 bug.cpp
    /tmp/bug-FYJpAX.o: In function `B<void, int, &(foo(int))>::B()':
undefined reference to `B<void, int, &(foo(int))>::v'
    clang: error: linker command failed with exit code 1 (use -v to see

The compiler seems to have treated v as if it were a static data member.

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/20130427/58a91094/attachment.html>

More information about the llvm-bugs mailing list