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/] [cpp0x/] [trailing1.C] - Diff between revs 301 and 338

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

Rev 301 Rev 338
// Tests for late-specified return type.
// Tests for late-specified return type.
// { dg-options "-std=c++0x" }
// { dg-options "-std=c++0x" }
auto f() -> int
auto f() -> int
{
{
  return 0;
  return 0;
}
}
template
template
auto add(T t, U u) -> decltype (t+u)
auto add(T t, U u) -> decltype (t+u)
{
{
  return t+u;
  return t+u;
}
}
template
template
decltype(T()+U()) add2(T t, U u)
decltype(T()+U()) add2(T t, U u)
{
{
  return t+u;
  return t+u;
}
}
template 
template 
U ag (T, U)
U ag (T, U)
{
{
  return U();
  return U();
}
}
template
template
auto add3(T t, U u) -> decltype (ag(t,u))
auto add3(T t, U u) -> decltype (ag(t,u))
{
{
  return ag(t,u);
  return ag(t,u);
}
}
template
template
decltype(*(T*)0+*(U*)0) add4(T t, U u)
decltype(*(T*)0+*(U*)0) add4(T t, U u)
{
{
  return t+u;
  return t+u;
}
}
template 
template 
struct A
struct A
{
{
  T f() {}
  T f() {}
  template 
  template 
  T g() {}
  T g() {}
  template 
  template 
  struct B
  struct B
  {
  {
    int MEM;
    int MEM;
  };
  };
};
};
template 
template 
auto f(T* t) -> decltype (t->f())
auto f(T* t) -> decltype (t->f())
{
{
  return t->f();
  return t->f();
}
}
template 
template 
auto g(T t) -> decltype (t.f())
auto g(T t) -> decltype (t.f())
{
{
  return t.f();
  return t.f();
}
}
template 
template 
auto h(T t, U u) -> decltype (t.template g())
auto h(T t, U u) -> decltype (t.template g())
{
{
  return t.template g();
  return t.template g();
}
}
struct D { };
struct D { };
struct C: public A::B
struct C: public A::B
{
{
};
};
template 
template 
auto k(T t, U u, V v) -> decltype (t.U::template B::MEM)
auto k(T t, U u, V v) -> decltype (t.U::template B::MEM)
{
{
  return t.U::template B::MEM;
  return t.U::template B::MEM;
}
}
// For these two examples we can elide the 'decltype' and just mangle the type.
// For these two examples we can elide the 'decltype' and just mangle the type.
template 
template 
auto l(T t) -> decltype (t)
auto l(T t) -> decltype (t)
{
{
  return t;
  return t;
}
}
template 
template 
auto m(T t) -> decltype (u)
auto m(T t) -> decltype (u)
{
{
  return t;
  return t;
}
}
A a, *p;
A a, *p;
int main()
int main()
{
{
  // { dg-final { scan-assembler  "_Z3addIidEDTplfp_fp0_ET_T0_" } }
  // { dg-final { scan-assembler  "_Z3addIidEDTplfp_fp0_ET_T0_" } }
  auto i = add(1, 2.0);
  auto i = add(1, 2.0);
  // { dg-final { scan-assembler "_Z4add4IidEDTpldecvPT_Li0EdecvPT0_Li0EES0_S2_" } }
  // { dg-final { scan-assembler "_Z4add4IidEDTpldecvPT_Li0EdecvPT0_Li0EES0_S2_" } }
  auto i4 = add4(1, 2.0);
  auto i4 = add4(1, 2.0);
  // { dg-final { scan-assembler "_Z4add2IidEDTplcvT__EcvT0__EES0_S1_" } }
  // { dg-final { scan-assembler "_Z4add2IidEDTplcvT__EcvT0__EES0_S1_" } }
  auto i2 = add2(1, 2.0);
  auto i2 = add2(1, 2.0);
  // { dg-final { scan-assembler "_Z4add3IidEDTcl2agfp_fp0_EET_T0_" } }
  // { dg-final { scan-assembler "_Z4add3IidEDTcl2agfp_fp0_EET_T0_" } }
  auto i3 = add3(1, 2.0);
  auto i3 = add3(1, 2.0);
  // { dg-final { scan-assembler "_Z1fI1AIiEEDTclptfp_1fEEPT_" } }
  // { dg-final { scan-assembler "_Z1fI1AIiEEDTclptfp_1fEEPT_" } }
  f(p);
  f(p);
  // { dg-final { scan-assembler "_Z1gI1AIiEEDTcldtfp_1fEET_" } }
  // { dg-final { scan-assembler "_Z1gI1AIiEEDTcldtfp_1fEET_" } }
  g(a);
  g(a);
  // { dg-final { scan-assembler "_Z1hI1AIiEdEDTcldtfp_1gIT0_EEET_S2_" } }
  // { dg-final { scan-assembler "_Z1hI1AIiEdEDTcldtfp_1gIT0_EEET_S2_" } }
  h(a,1.0);
  h(a,1.0);
  // { dg-final { scan-assembler "_Z1kI1C1AIiE1DEDtdtfp_srNT0_1BIT1_EE3MEMET_S4_S6_" } }
  // { dg-final { scan-assembler "_Z1kI1C1AIiE1DEDtdtfp_srNT0_1BIT1_EE3MEMET_S4_S6_" } }
  k( C(), A(), D() );
  k( C(), A(), D() );
  // { dg-final { scan-assembler "_Z1lIiET_S0_" } }
  // { dg-final { scan-assembler "_Z1lIiET_S0_" } }
  l(1);
  l(1);
  // { dg-final { scan-assembler "_Z1mIiLi1EET_S0_" } }
  // { dg-final { scan-assembler "_Z1mIiLi1EET_S0_" } }
  m(1);
  m(1);
}
}
 
 

powered by: WebSVN 2.1.0

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