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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [expr/] [lval2.C] - Blame information for rev 754

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
// PR c++/19199
2
 
3
// { dg-do run }
4
 
5
// We used to turn the COND_EXPR lvalue into a MIN_EXPR rvalue, and
6
// then return a reference to a temporary in qMin.
7
 
8
#include 
9
 
10
enum Foo { A, B };
11
 
12
template T &qMin(T &a, T &b)
13
{
14
  return a < b ? a : b;
15
}
16
 
17
int main (int,  char **)
18
{
19
  Foo f = A;
20
  Foo g = B;
21
  Foo &h = qMin(f, g);
22
  assert (&h == &f || &h == &g);
23
  const Foo &i = qMin((const Foo&)f, (const Foo&)g);
24
  assert (&i == &f || &i == &g);
25
  return 0;
26
}
27
 

powered by: WebSVN 2.1.0

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