[LLVMbugs] [Bug 23234] New: Link error with variable template

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Apr 14 16:50:50 PDT 2015


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

            Bug ID: 23234
           Summary: Link error with variable template
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++14
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ldionne.2 at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The following code does not link with Clang r234717:

------------------------------------------------------------------------------
struct f {
    void operator()() const { }
};

template <typename T>
auto vtemplate = f{};

int main() {
    vtemplate<int>();
}
------------------------------------------------------------------------------

Something curious is that replacing

    auto vtemplate = f{};
by
    f vtemplate{};

resolves the problem. Also note that I think the problem was introduced 
recently, because I could almost swear that this compiled fine about a 
week ago.


The exact output is:
› ~/code/llvm/release/bin/clang++ -std=c++1y ~/code/hana/test/worksheet.cpp
Undefined symbols for architecture x86_64:
  "vtemplate<int>", referenced from:
      _main in worksheet-0a36a3.o
ld: symbol(s) not found for architecture x86_64

-- 
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/20150414/ef1dd0b9/attachment.html>


More information about the llvm-bugs mailing list