[LLVMbugs] [Bug 22825] New: variable template not default initialized

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Mar 6 10:11:48 PST 2015


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

            Bug ID: 22825
           Summary: variable template not default initialized
           Product: clang
           Version: 3.5
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++14
          Assignee: unassignedclangbugs at nondot.org
          Reporter: camorton2 at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

// clang reports this as a link error, val is not defined

template<class A>  A val ;

void init()
{
   val<int> = 55;
}

int main(void)
{
   init(); // without init should it be 0?
   return val<int>;
}

My guess is that without the call to init it should be default initialized to
0.

tmp/ex9-b3b6e9.o:(.toc+0x0): undefined reference to `val<int>'
clang: error: linker command failed with exit code 1 (use -v to see invocation)


any variable template without an explicit initializer gives a linker error

If the type is a class type there is no diagnostic check to ensure there is a
default constructor, and there is no call to the default constructor.

-- 
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/20150306/6b42f1df/attachment.html>


More information about the llvm-bugs mailing list