[llvm-bugs] [Bug 47160] New: `llvm::is_trivially_copyable` -- static assertion failure after DR 1734

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 13 15:51:51 PDT 2020


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

            Bug ID: 47160
           Summary: `llvm::is_trivially_copyable` -- static assertion
                    failure after DR 1734
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: Support Libraries
          Assignee: unassignedbugs at nondot.org
          Reporter: npmazzuca at gmail.com
                CC: llvm-bugs at lists.llvm.org

I believe only VC++ 19.27 (latest version) actually implements DR 1734, but
`llvm::is_trivially_copyable` doesn't agree with `std::is_trivially_copyable`
on `pair<void*, size_t>` after DR 1734. This results in a build error:

C:\...\llvm\include\llvm/Support/type_traits.h(181): error C2338: inconsistent
behavior between llvm:: and std:: implementation of is_trivially_copyable
C:\...\llvm\include\llvm/ADT/SmallVector.h(315): note: see reference to class
template instantiation 'llvm::is_trivially_copyable<T>' being compiled
        with
        [
            T=std::pair<void *,size_t>
        ]
C:\...\llvm\include\llvm/ADT/SmallVector.h(837): note: see reference to class
template instantiation 'llvm::SmallVectorImpl<T>' being compiled
        with
        [
            T=std::pair<void *,size_t>
        ]
C:\...\llvm\include\llvm/Support/Allocator.h(378): note: see reference to class
template instantiation 'llvm::SmallVector<std::pair<void *,size_t>,0>' being
compiled
C:\...\llvm\include\llvm/Support/Allocator.h(435): note: see reference to class
template instantiation
'llvm::BumpPtrAllocatorImpl<AllocatorT,SlabSize,SizeThreshold>' being compiled
C:\...\llvm\include\llvm/ADT/SmallVector.h(315): error C2976:
'llvm::SmallVectorTemplateBase': too few template arguments
C:\...\llvm\include\llvm/ADT/SmallVector.h(179): note: see declaration of
'llvm::SmallVectorTemplateBase'

A simple example of a program that changes behavior after DR 1734 is the
following:

struct meow {
    meow(const meow&) = default;
    meow& operator=(const volatile meow&) = delete;
    template <class U = meow>
    meow& operator=(const U&) {}
};
static_assert(__is_trivially_copyable(meow));

-- 
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/20200813/3018f256/attachment-0001.html>


More information about the llvm-bugs mailing list