OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.dg/] [gomp/] [tpl-atomic-2.C] - Diff between revs 301 and 338

Only display areas with differences | Details | Blame | View Log

Rev 301 Rev 338
// { dg-do compile }
// { dg-do compile }
struct S { int x; } s;
struct S { int x; } s;
// Make sure we detect errors on non-type-dependent things
// Make sure we detect errors on non-type-dependent things
// even when the templates are never instantiated.
// even when the templates are never instantiated.
template void f1()
template void f1()
{
{
  #pragma omp atomic
  #pragma omp atomic
  s += 1;               // { dg-error "invalid" }
  s += 1;               // { dg-error "invalid" }
}
}
template void f2(float *f)
template void f2(float *f)
{
{
  #pragma omp atomic
  #pragma omp atomic
  *f |= 1;              // { dg-error "invalid|evaluation" }
  *f |= 1;              // { dg-error "invalid|evaluation" }
}
}
// Here the rhs is dependent, but not type dependent.
// Here the rhs is dependent, but not type dependent.
template void f3(float *f)
template void f3(float *f)
{
{
  #pragma omp atomic
  #pragma omp atomic
  *f |= sizeof (T);     // { dg-error "invalid|evaluation" }
  *f |= sizeof (T);     // { dg-error "invalid|evaluation" }
}
}
// And the converse, no error here because we're never fed a T.
// And the converse, no error here because we're never fed a T.
template void f4(T *t)
template void f4(T *t)
{
{
  #pragma omp atomic
  #pragma omp atomic
  *t += 1;
  *t += 1;
}
}
// Here we'll let it go, because the rhs is type dependent and
// Here we'll let it go, because the rhs is type dependent and
// we can't properly instantiate the statement, and we do most
// we can't properly instantiate the statement, and we do most
// of the semantic analysis concurrent with that.
// of the semantic analysis concurrent with that.
template void f5(float *f)
template void f5(float *f)
{
{
  #pragma omp atomic
  #pragma omp atomic
  *f |= (T)sizeof(T);   // { dg-error "invalid|evaluation" "" { xfail *-*-* } }
  *f |= (T)sizeof(T);   // { dg-error "invalid|evaluation" "" { xfail *-*-* } }
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.