[libcxx] r333327 - Fix GCC handling of ATOMIC_VAR_INIT

JF Bastien via cfe-commits cfe-commits at lists.llvm.org
Fri May 25 17:13:53 PDT 2018

Author: jfb
Date: Fri May 25 17:13:53 2018
New Revision: 333327

URL: http://llvm.org/viewvc/llvm-project?rev=333327&view=rev
Fix GCC handling of ATOMIC_VAR_INIT

r333325 from D47225 added warning checks, and the test was written to be C++11 correct by using ATOMIC_VAR_INIT (note that the committee fixed that recently...). It seems like GCC can't handle ATOMIC_VAR_INIT well because it generates 'type 'std::atomic<int>' cannot be initialized with an initializer list' on bot libcxx-libcxxabi-x86_64-linux-ubuntu-cxx03. Drop the ATOMIC_VAR_INITs since they weren't required to test the diagnostics.


Modified: libcxx/trunk/test/libcxx/atomics/diagnose_nonnull.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/atomics/diagnose_nonnull.fail.cpp?rev=333327&r1=333326&r2=333327&view=diff
--- libcxx/trunk/test/libcxx/atomics/diagnose_nonnull.fail.cpp (original)
+++ libcxx/trunk/test/libcxx/atomics/diagnose_nonnull.fail.cpp Fri May 25 17:13:53 2018
@@ -17,8 +17,8 @@
 #include <atomic>
 int main() {
-  std::atomic<int> ai = ATOMIC_VAR_INIT(0);
-  volatile std::atomic<int> vai = ATOMIC_VAR_INIT(0);
+  std::atomic<int> ai;
+  volatile std::atomic<int> vai;
   int i = 42;
   atomic_is_lock_free((const volatile std::atomic<int>*)0); // expected-error {{null passed to a callee that requires a non-null argument}}

More information about the cfe-commits mailing list