<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 - concepts-related information does not propogated through precompiled headers"
   href="https://bugs.llvm.org/show_bug.cgi?id=45115">45115</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>concepts-related information does not propogated through precompiled headers
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>10.0
          </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>enhancement
          </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>vopl@bk.ru
          </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>$ cat pch.hpp
#pragma once

template <class T> concept CncChar = sizeof(char)==sizeof(T);
template <class T> concept CncInt = sizeof(int)==sizeof(T);

template <class T> void f() requires CncInt<T> {}
template <class T> void f() requires CncChar<T> {}

$ cat main.cpp
//clang++ -std=gnu++2a pch.hpp -o pch.hpp.pch
//clang++ -std=gnu++2a -include-pch pch.hpp.pch -c main.cpp

#include "pch.hpp"

int main()
{
    f<int>();
    return 0;
}

# try compile main.cpp WITHOUT precompiled headers
$ clang++ -std=gnu++2a -c main.cpp && echo OK
OK
$
$
$# try compile main.cpp WITH precompiled headers - fail
$ clang++ -std=gnu++2a pch.hpp -o pch.hpp.pch
$ clang++ -std=gnu++2a -include-pch pch.hpp.pch -c main.cpp
main.cpp:8:5: error: no matching function for call to 'f'
    f<int>();
    ^~~~~~
./pch.hpp:7:25: note: candidate template ignored: constraints not satisfied
[with T = int]
template <class T> void f() requires CncChar<T> {}
                        ^
./pch.hpp:7:38: note: because 'int' does not satisfy 'CncChar'
template <class T> void f() requires CncChar<T> {}
                                     ^
./pch.hpp:3:38: note: because 'sizeof(char) == sizeof(int)' (1 == 4) evaluated
to false
template <class T> concept CncChar = sizeof(char)==sizeof(T);
                                     ^
1 error generated.</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>