From 31c3814ef301549599411769eec7a2a73ece112b Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Mon, 4 Aug 2014 18:28:36 +0000 Subject: Merging r214369: ------------------------------------------------------------------------ r214369 | rsmith | 2014-07-30 17:22:56 -0700 (Wed, 30 Jul 2014) | 2 lines Rename this test so that it actually runs, and fix it so that it passes. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_35@214743 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/SemaCXX/atomic-type.cpp | 58 ++++++++++++++++++++++++++++++++++++++++++++ test/SemaCXX/atomic-type.cxx | 58 -------------------------------------------- 2 files changed, 58 insertions(+), 58 deletions(-) create mode 100644 test/SemaCXX/atomic-type.cpp delete mode 100644 test/SemaCXX/atomic-type.cxx diff --git a/test/SemaCXX/atomic-type.cpp b/test/SemaCXX/atomic-type.cpp new file mode 100644 index 0000000000..f522d92f39 --- /dev/null +++ b/test/SemaCXX/atomic-type.cpp @@ -0,0 +1,58 @@ +// RUN: %clang_cc1 -verify -pedantic %s + +template struct atomic { + _Atomic(T) value; + + void f() _Atomic; // expected-error {{expected ';' at end of declaration list}} +}; + +template struct user { + struct inner { char n[sizeof(T)]; }; + atomic i; +}; + +user u; + +// Test overloading behavior of atomics. +struct A { }; + +int &ovl1(_Atomic(int)); +int &ovl1(_Atomic int); // ok, redeclaration +long &ovl1(_Atomic(long)); +float &ovl1(_Atomic(float)); +double &ovl1(_Atomic(A const *const *)); +double &ovl1(A const *const *_Atomic); +short &ovl1(_Atomic(A **)); + +void test_overloading(int i, float f, _Atomic(int) ai, _Atomic(float) af, + long l, _Atomic(long) al, A const *const *acc, + A const ** ac, A **a) { + int& ir1 = ovl1(i); + int& ir2 = ovl1(ai); + long& lr1 = ovl1(l); + long& lr2 = ovl1(al); + float &fr1 = ovl1(f); + float &fr2 = ovl1(af); + double &dr1 = ovl1(acc); + double &dr2 = ovl1(ac); + short &sr1 = ovl1(a); +} + +typedef int (A::*fp)() _Atomic; // expected-error {{expected ';' after top level declarator}} expected-warning {{does not declare anything}} + +typedef _Atomic(int(A::*)) atomic_mem_ptr_to_int; +typedef int(A::*_Atomic atomic_mem_ptr_to_int); + +typedef _Atomic(int)(A::*mem_ptr_to_atomic_int); +typedef _Atomic int(A::*mem_ptr_to_atomic_int); + +typedef _Atomic(int)&atomic_int_ref; +typedef _Atomic int &atomic_int_ref; +typedef _Atomic atomic_int_ref atomic_int_ref; // expected-warning {{'_Atomic' qualifier on reference type 'atomic_int_ref' (aka '_Atomic(int) &') has no effect}} + +typedef int &_Atomic atomic_reference_to_int; // expected-error {{'_Atomic' qualifier may not be applied to a reference}} +typedef _Atomic(int &) atomic_reference_to_int; // expected-error {{_Atomic cannot be applied to reference type 'int &'}} + +struct S { + _Atomic union { int n; }; // expected-warning {{anonymous union cannot be '_Atomic'}} +}; diff --git a/test/SemaCXX/atomic-type.cxx b/test/SemaCXX/atomic-type.cxx deleted file mode 100644 index 947bb3c5f4..0000000000 --- a/test/SemaCXX/atomic-type.cxx +++ /dev/null @@ -1,58 +0,0 @@ -// RUN: %clang_cc1 -verify -pedantic %s - -template struct atomic { - _Atomic(T) value; - - void f() _Atomic; // expected-error {{expected ';' at end of declaration list}} -}; - -template struct user { - struct inner { char n[sizeof(T)]; }; - atomic i; -}; - -user u; - -// Test overloading behavior of atomics. -struct A { }; - -int &ovl1(_Atomic(int)); -int &ovl1(_Atomic int); // ok, redeclaration -long &ovl1(_Atomic(long)); -float &ovl1(_Atomic(float)); -double &ovl1(_Atomic(A const *const *)); -double &ovl1(A const *const *_Atomic); -short &ovl1(_Atomic(A **)); - -void test_overloading(int i, float f, _Atomic(int) ai, _Atomic(float) af, - long l, _Atomic(long) al, A const *const *acc, - A const ** ac, A **a) { - int& ir1 = ovl1(i); - int& ir2 = ovl1(ai); - long& lr1 = ovl1(l); - long& lr2 = ovl1(al); - float &fr1 = ovl1(f); - float &fr2 = ovl1(af); - double &dr1 = ovl1(acc); - double &dr2 = ovl1(ac); - short &sr1 = ovl1(a); -} - -typedef int (A::*fp)() _Atomic; // expected-error {{expected ';' after top level declarator}} expected-warning {{does not declare anything}} - -typedef _Atomic(int(A::*)) atomic_mem_ptr_to_int; -typedef int(A::*_Atomic atomic_mem_ptr_to_int); - -typedef _Atomic(int)(A::*mem_ptr_to_atomic_int); -typedef _Atomic int(A::*mem_ptr_to_atomic_int); - -typedef _Atomic(int)&atomic_int_ref; -typedef _Atomic int &atomic_int_ref; -typedef _Atomic atomic_int_ref atomic_int_ref; // ok, qualifiers on references ignored in this case. - -typedef int &_Atomic atomic_reference_to_int; // expected-error {{'_Atomic' qualifier may not be applied to a reference}} -typedef _Atomic(int &) atomic_reference_to_int; // expected-error {{_Atomic cannot be applied to reference type 'int &'}} - -struct S { - _Atomic union { int n; }; // expected-warning {{anonymous union cannot be '_Atomic'}} -}; -- cgit v1.2.3