<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - Explicit template instantiation fails for templated constructor."
   href="https://bugs.llvm.org/show_bug.cgi?id=50376">50376</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Explicit template instantiation fails for templated constructor.
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </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>C++
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>qtom.boehmer@googlemail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>##### Begin Example: <a href="https://godbolt.org/z/87PcP68zo">https://godbolt.org/z/87PcP68zo</a>
struct B
{
    B() = default;

    template<typename T>
    B()
    {}

    template<typename T>
    B construct() { return B{}; }
};

// This works.
//template B B::construct<int>(); // ok

// None of these compile in Clang. GCC compiles them fine.
//template B::B<int>(); // (1) fails to compile
//template B::template B<int>(); // (2) fails to compile
//template B B::template construct<int>(); // (3) fails to compile
##### End Example

##### Begin Error Messages
# Error Message for (1):
<source>:18:13: error: qualified reference to 'B' is a constructor name rather
than a type in this context
template B::B<int>(); // fails to compile
            ^
<source>:18:14: error: expected unqualified-id
template B::B<int>(); // fails to compile
             ^
2 errors generated.

# Error Message for (2):
<source>:19:22: error: 'B' following the 'template' keyword does not refer to a
template
template B::template B<int>(); // fails to compile
         ~~~~~~~~~~~ ^
<source>:1:8: note: declared as a non-template here
struct B
       ^
<source>:19:29: error: expected unqualified-id
template B::template B<int>(); // fails to compile

# Error Message for (3):
<source>:19:15: error: 'template' keyword not permitted here
template B B::template construct<int>(); // (3) fails to compile
              ^~~~~~~~~
1 error generated.
##### End Error Messages</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>