view gcc/testsuite/g++.dg/warn/Wrestrict-2.C @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
line wrap: on
line source

// PR c++/79588
// { dg-do compile }
// { dg-options "-Wrestrict" }

void foo (char *__restrict, char *__restrict = __null);

template <int N>
void
bar (char **p)
{
  foo (p[0], p[0]);	// { dg-warning "to 'restrict'-qualified parameter aliases with" }
  foo (p[0], p[N]);	// { dg-warning "to 'restrict'-qualified parameter aliases with" }
  foo (p[0]);
}

template <int N>
void
bar2 (char **p)
{
  foo (p[0], p[0]);	// { dg-warning "to 'restrict'-qualified parameter aliases with" }
  foo (p[0], p[N]);	// { dg-bogus "to 'restrict'-qualified parameter aliases with" }
  foo (p[0]);
}

void
baz (char **p)
{
  bar<0> (p);
  bar2<1> (p);
}