Introduce concepts for AccessTraits#1253
Conversation
| template <typename Traits> | ||
| using AccessTraitsMemorySpaceArchetypeAlias = typename Traits::memory_space; | ||
| template <class T, class U> | ||
| concept not_same_as = !std::same_as<T, U>; |
There was a problem hiding this comment.
I added this because there does not seem to be a non-void concept in std, and !std::same_as<void> did not work.
|
@dalg24 Could you please take a look at this PR? |
31bcb16 to
e8e40e2
Compare
|
Moved 'Concepts' namespace inside |
|
Here are what the errors look like for the In LLVM: So I see two suboptimal messages:
|
|
It seems that the details of notes seem to depend on whether but Which is fine, but is still interesting. |
|
@dalg24 I added couple commits:
I do agree with you that if the concepts allowed to specify our error messages, that would be ideal. The only step in that direction I've seen is the [EWG] P1267, but it went nowhere, it seems. The only alternative I see is to name each step of our concepts with some meaningful name, which is a pain. |
636eb39 to
b252a5a
Compare
Introduce complete_type<> concept.
<snip>/benchmarks/triangulated_surface_distance/triangulated_surface_distance.cpp:38:1: error: 'AccessTraits' defined as a class template here but previously declared as a struct template; this is valid, but may result in linker errors under the Microsoft C++ ABI [clang-diagnostic-mismatched-tags,-warnings-as-errors]
Does not work with nvcc. This reverts commit 9f5b59e.
b252a5a to
c093490
Compare
|
The error messages of nvcc compiler for concepts are baffingly bad; no explanations are given for the concept check failures. |
The patch introduces three concepts:
AccessTraits,Primitives(same asAccessTraits) andPredicates(AccessTraits+ tag). I put them intoConceptsnamespace.In general, it works fine. One corner point is how it interacts with CTAD.
clangevaluates the right hand side of CTAD before testing the concept, which leads to suboptimal errors instead of ignoring the CTAD (see godbolt). GCC, on the other hand, has a better treatment and properly rejects CTAD due to the unsatisfied requirement.