saarraz / clang-concepts-monorepo

****** OBSOLETE - CONCEPTS HAS BEEN MERGED INTO CLANG TRUNK AND DEVELOPMENT CONTINUES THERE ****** This fork of llvm-project contains my implementation of C++2a Concepts for the Clang compiler, and will be updated regularly with bug fixes until the whole feature is merged to trunk. Follow the instructions here https://clang.llvm.org/get_started.html to build, then use the flags "-std=c++2a -Xclang -fconcepts-ts" to enable concepts.
27 stars 3 forks source link

Cannot yet mangle expression type RequiresExpr #2

Open Quincunx271 opened 5 years ago

Quincunx271 commented 5 years ago

When using a requires-expression as a template argument such as enable_if</* requires expression */>, the compiler emits: "error: cannot yet mangle expression type RequiresExpr". Some examples:

https://godbolt.org/z/J42cg7

#include <type_traits>

int main() {
    return [](auto x,
        std::enable_if_t<requires(decltype(x) it){ +1; }, int> = 0){
            return +x;
    }(42);
}

https://godbolt.org/z/fMaye4

#include <type_traits>

template <typename T>
auto foo(T x, std::enable_if_t<requires(decltype(x) it){ +it; }, int> = 0) {
    return +x;
}

int main() {
    return foo(42);
}

Yes, I know that they can be placed in a requires clause on the lambda/function. I'm intentionally doing strange things.


As mentioned in the cpplang slack, "The mangling of requires expressions is yet undefined by the Itanium ABI", which is likely why this fails to compile