<html>
    <head>
      <base href="http://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 --- - variable template not default initialized"
   href="http://llvm.org/bugs/show_bug.cgi?id=22825">22825</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>variable template not default initialized
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.5
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </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>camorton2@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>// 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.</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>