[LLVMbugs] [Bug 22989] New: function template/generic lambda/local class/member function => undefined symbol

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Mar 22 16:31:30 PDT 2015


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

            Bug ID: 22989
           Summary: function template/generic lambda/local class/member
                    function => undefined symbol
           Product: clang
           Version: trunk
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++14
          Assignee: unassignedclangbugs at nondot.org
          Reporter: alex.cossette at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Attempts to call a member function in a local class nested in a generic lambda
nested in a function template results in an undefined symbol link error.

template <class>
void f() {
    [](auto a) {
        struct C {
            static void g() {}
        };
        C::g();
    }(0);
}

int main() {
    f<void>();
}

$clang -std=c++14 link_error.cpp
  warning: inline function 'f()::(anonymous class)::operator()(int)::C::g' is
not
  defined [-Wundefined-inline]
                        static void g() {}
                                    ^
  link_error.cpp:7:6: note: used here
                C::g();
                   ^
  1 warning generated.
  Undefined symbols for architecture x86_64:
    "auto void f<void>()::'lambda'(void)::operator()<int>(void) const::C::g()",
  referenced from:
    auto void f<void>()::'lambda'(void)::operator()<int>(void) const in
    link_error-b8a662.o
  ld: symbol(s) not found for architecture x86_64
  clang: error: linker command failed with exit code 1 (use -v to see
invocation)

$clang --version
  clang version 3.7.0  (http://llvm.org/git/llvm.git
    00edfaecf079bd80ed9d26f6e97fcdfc936c6937)
  Target: x86_64-apple-darwin14.1.0
  Thread model: posix

Also tested with 3.5 and 3.6 with same result.

-- 
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/20150322/6c7db9e9/attachment.html>


More information about the llvm-bugs mailing list