https://bugs.llvm.org/show_bug.cgi?id=50740

            Bug ID: 50740
           Summary: __is_trivial doesn't work in the presence of special
                    member functions with trailing requires clauses
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++2a
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

When compiled with Clang ToT, the following code incorrectly believes that
allocator<void> is non-trivial, when it should be trivial:

cat <<EOF | clang++ -xc++ - -std=c++2a -fsyntax-only
#include <type_traits>

template <class T>
struct allocator {
    allocator() = default;
    allocator() requires(!std::is_void_v<T>) { }
};

static_assert(__is_trivial(allocator<void>));

int main() { }
EOF

This works on GCC. Godbolt link: https://godbolt.org/z/4osMGWTne.

I tracked the issue down a bit, and  I think the issue is that when
QualType::isTrivialType() queries whether the class declaration has a
non-trivial default constructor (via
CXXRecordDecl::hasNonTrivialDefaultConstructor()), it incorrectly believes that
it's the case.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to