Home | History | Annotate | Download | only in SemaCXX
      1 // RUN: %clang_cc1 -fsyntax-only -verify %s
      2 
      3 #define restrict __restrict__
      4 typedef int* ptr;
      5 void test1(ptr p, const ptr cp, restrict ptr rp, const restrict ptr crp,
      6            volatile ptr vp, const volatile ptr cvp, restrict volatile ptr rvp,
      7            const restrict volatile ptr crvp) {
      8   ptr& p1 = p;
      9   ptr& p2 = cp; // expected-error {{drops 'const' qualifier}}
     10   ptr& p3 = rp; // expected-error {{drops 'restrict' qualifier}}
     11   ptr& p4 = crp; // expected-error {{drops 'const' and 'restrict' qualifiers}}
     12   ptr& p5 = vp; // expected-error {{drops 'volatile' qualifier}}
     13   ptr& p6 = cvp; // expected-error {{drops 'const' and 'volatile' qualifiers}}
     14   ptr& p7 = rvp; // expected-error {{drops 'restrict' and 'volatile' qualifiers}}
     15   ptr& p8 = crvp; // expected-error {{drops 'const', 'restrict', and 'volatile' qualifiers}}
     16 
     17   const ptr& cp1 = p;
     18   const ptr& cp2 = cp;
     19   const ptr& cp3 = rp; // expected-error {{drops 'restrict' qualifier}}
     20   const ptr& cp4 = crp; // expected-error {{drops 'restrict' qualifier}}
     21   const ptr& cp5 = vp; // expected-error {{drops 'volatile' qualifier}}
     22   const ptr& cp6 = cvp; // expected-error {{drops 'volatile' qualifier}}
     23   const ptr& cp7 = rvp; // expected-error {{drops 'restrict' and 'volatile' qualifiers}}
     24   const ptr& cp8 = crvp; // expected-error {{drops 'restrict' and 'volatile' qualifiers}}
     25 
     26   const volatile ptr& cvp1 = p;
     27   const volatile ptr& cvp2 = cp;
     28   const volatile ptr& cvp3 = rp; // expected-error {{drops 'restrict' qualifier}}
     29   const volatile ptr& cvp4 = crp; // expected-error {{drops 'restrict' qualifier}}
     30   const volatile ptr& cvp5 = vp;
     31   const volatile ptr& cvp6 = cvp;
     32   const volatile ptr& cvp7 = rvp; // expected-error {{drops 'restrict' qualifier}}
     33   const volatile ptr& cvp8 = crvp; // expected-error {{drops 'restrict' qualifier}}
     34 
     35   const restrict volatile ptr& crvp1 = p;
     36   const restrict volatile ptr& crvp2 = cp;
     37   const restrict volatile ptr& crvp3 = rp;
     38   const restrict volatile ptr& crvp4 = crp;
     39   const restrict volatile ptr& crvp5 = vp;
     40   const restrict volatile ptr& crvp6 = cvp;
     41   const restrict volatile ptr& crvp7 = rvp;
     42   const restrict volatile ptr& crvp8 = crvp;
     43 }
     44