[llvm-bugs] [Bug 45115] New: concepts-related information does not propogated through precompiled headers
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Mar 5 04:05:18 PST 2020
https://bugs.llvm.org/show_bug.cgi?id=45115
Bug ID: 45115
Summary: concepts-related information does not propogated
through precompiled headers
Product: clang
Version: 10.0
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++2a
Assignee: unassignedclangbugs at nondot.org
Reporter: vopl at bk.ru
CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk
$ 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.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200305/00328175/attachment.html>
More information about the llvm-bugs
mailing list