2012/12/3 Thiago Macieira <[email protected]> > On segunda-feira, 3 de dezembro de 2012 15.37.13, Francisco Lopes wrote: > > Please take a look at my last comment on the bug report ( > > http://llvm.org/bugs/show_bug.cgi?id=14486#c10). If my analysis is > right, > > it's wrong to use "= {0}" with an inaccessible copy constructor. > > Looking at N3337, this is the API required for std::atomic: > > atomic() noexcept = default; > constexpr atomic(T) noexcept; > atomic(const atomic&) = delete; > atomic& operator=(const atomic&) = delete; > atomic& operator=(const atomic&) volatile = delete; > T operator=(T) volatile noexcept; > T operator=(T) noexcept; > > It also defines ATOMIC_VAR_INIT and in 29.6.5 > [atomics.types.operations.req] > paragraph 6 we find this example: > > atomic<int> v = ATOMIC_VAR_INIT(5); > > The standard does not define what ATOMIC_VAR_INIT is. GCC defines it as: > > #define ATOMIC_VAR_INIT(_VI) { _VI } > > And clang defines it (see [1]) as: > #define ATOMIC_VAR_INIT(__v) {__v} > > With constructors: > _LIBCPP_INLINE_VISIBILITY > atomic() _NOEXCEPT {} // = default; > _LIBCPP_INLINE_VISIBILITY > _LIBCPP_CONSTEXPR atomic(_Tp __d) _NOEXCEPT : __base(__d) {} > > _LIBCPP_INLINE_VISIBILITY > _Tp operator=(_Tp __d) volatile _NOEXCEPT > {__base::store(__d); return __d;} > _LIBCPP_INLINE_VISIBILITY > _Tp operator=(_Tp __d) _NOEXCEPT > {__base::store(__d); return __d;} > > inheriting: > __atomic_base(const __atomic_base&) = delete; > __atomic_base& operator=(const __atomic_base&) = delete; > __atomic_base& operator=(const __atomic_base&) volatile = delete; > > In other words, libc++'s own std::atomic is supposed to be initialised by > braces with a deleted copy constructor and assignment operator. It seems > to me > that it's a compiler bug. > > [1] http://llvm.org/svn/llvm-project/libcxx/trunk/include/atomic > -- > Thiago Macieira - thiago.macieira (AT) intel.com > Software Architect - Intel Open Source Technology Center >
Can you point out where in the standard brace assignment initialization is not supposed to invoke a copy constructor? Because from what I've pointed, I only see this case, and so I see both the compiler not working as expected as both the qt and all this library code as ill-formed.
_______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
