<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - function template/generic lambda/local class/member function => undefined symbol"
   href="https://llvm.org/bugs/show_bug.cgi?id=22989">22989</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>function template/generic lambda/local class/member function => undefined symbol
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++14
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>alex.cossette@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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  (<a href="http://llvm.org/git/llvm.git">http://llvm.org/git/llvm.git</a>
    00edfaecf079bd80ed9d26f6e97fcdfc936c6937)
  Target: x86_64-apple-darwin14.1.0
  Thread model: posix

Also tested with 3.5 and 3.6 with same result.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>