<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 - C++20 template Constraints doesn't evaluate the current calling context"
   href="https://bugs.llvm.org/show_bug.cgi?id=45663">45663</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>C++20 template Constraints doesn't evaluate the current calling context
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>10.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </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++2a
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>sharklienx@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=23399" name="attach_23399" title="Self-describing source code copy, from godbolt.org link.Feel free to test the code">attachment 23399</a> <a href="attachment.cgi?id=23399&action=edit" title="Self-describing source code copy, from godbolt.org link.Feel free to test the code">[details]</a></span>
Self-describing source code copy, from godbolt.org link.Feel free to test the
code

When a template instantiation attempt occur, the compiler seems to cache the
resulting instantiation attempt details.

The contraints evaluation along with the template are not further evaluated
correctly when further template instantiations are called, even if constraint
argument's context has changed.

This lead to valid constraint evaluation failure.
And so, it fails to instantiate specialized template, or function template
overload.


The details of such context change evaluation failure can be seen on this link
: <a href="https://godbolt.org/z/QMU6YC">https://godbolt.org/z/QMU6YC</a>
(This is MAtt Godbolt's website 'Compiler Explorer')

or a copy code from that link below as an attachment.

It explains step by step my testing context, and what I expected.

This testing context focus on :
- a concept testing inheritance (with pointer conversion requires),
- a template class 'Zeta' with template constructor overload using this concept
as a constraint,

- two classes 'Alpha' and 'Beta' with inheritance relationship, but the 'Beta'
derived class is forward declared,

- some 'Ss' class definitions with a 'Zeta<Alpha>' data member,
declaring two constructors using 'Zeta<Alpha>' and 'Zeta<Beta>' as arguments,
causing 'Zeta' constrained template constructor to be evaluated as a conversion
constructor, while 'Beta' is still not defined,
Note : 'Zeta' matching type argument copy-constructor is intended.

- 'Beta' defined as derived from 'Alpha' and using 'Ss' class definition (so it
need to be defined late),

- valid 'Ss' constructors definition : using 'Zeta<Beta>' to 'Zeta<Alpha>'
constrained template conversion-constructor instantiation, as 'Beta' is now
defined as inheriting 'Alpha'.


Problem summary :
- 'Beta' inheriting 'Alpha' Constraint evaluate to false, when 'Beta' is
already defined as inheriting 'Alpha'.

Expected :
- 'Zeta<Beta>' to 'Zeta<Alpha>' constrained conversion overload is selected, as
constraints are satisfied.</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>