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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to