[llvm-bugs] [Bug 41284] New: __has_trivial_destructor(_Atomic(int)) should be true (and other issues)

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Mar 28 17:28:43 PDT 2019


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

            Bug ID: 41284
           Summary: __has_trivial_destructor(_Atomic(int)) should be true
                    (and other issues)
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: comexk at gmail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

More generally, using raw _Atomic types rather than the std::atomic<T> wrapper
(e.g. in a -nostdinc context) is less ergonomic than it could be.  

__has_trivial_destructor(_Atomic(int)) returns false, and attempting to
destruct one using a generic wrapper produces an error:

template <typename T>
void destruct(T *t) {
    t->~T();
}

void a(_Atomic(int) *p) { destruct(p); }

->

<source>:3:6: error: object expression of non-scalar type '_Atomic(int)' cannot
be used in a pseudo-destructor expression

Also, although this is probably more effort to implement, Clang can't deduce
the parameter of an _Atomic() type:

template <typename T>
struct X;
template <typename T>
struct X<_Atomic(T)> {};

->
<source>:4:8: error: class template partial specialization contains a template
parameter that cannot be deduced; this partial specialization will never be
used [-Wunusable-partial-specialization]


Since these types are not defined by the C++ standard, there's no normative
answer on whether the current behavior is correct, but I think it would make
more sense if they worked closer to how one would expect.

-- 
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/20190329/87e94798/attachment.html>


More information about the llvm-bugs mailing list