<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 --- - C++ template instantiation bug"
   href="http://llvm.org/bugs/show_bug.cgi?id=16936">16936</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>C++ template instantiation bug
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.3
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </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>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>gentryx@gmx.de
          </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>Created <span class=""><a href="attachment.cgi?id=11069" name="attach_11069" title="test program which exhibits the bug when compiled with clang++, but not when using g++ or icpc">attachment 11069</a> <a href="attachment.cgi?id=11069&action=edit" title="test program which exhibits the bug when compiled with clang++, but not when using g++ or icpc">[details]</a></span>
test program which exhibits the bug when compiled with clang++, but not when
using g++ or icpc

Dear clang developers,

I was investigating whether our computer simulation library
LibGeoDecomp would work with clang++, when I noticed that some of the
unit tests were failing. Apparently clang++ handles partial
specialization of member function templates in combination with
inheritance differently from other compilers (e.g. g++ and icpc).

I've tried to come up with a minimal test program which reproduces the
odd behavior (attached). Having been pruned so much, the program
itself doesn't make much sense. It was originally part of our code
which handles boundary conditions. IMHO the program should yield the
output "function2" twice, but with clang++ I get "function5" for the
first invocation. Is this a bug in clang++, or is this simply
undefined behavior?

Reproduction:
-------------

icpc test3.cpp -o test && ./test && echo "-------------------------" &&  g++
test3.cpp -o test && ./test && echo "------------" && clang++ test3.cpp -o test
&& ./test

Output:
-------

function2
function2
-------------------------
function2
function2
------------
function5
function2

Thanks!
-Andreas</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>