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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [cpp0x/] [constexpr-function3.C] - Blame information for rev 774

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

Line No. Rev Author Line
1 693 jeremybenn
// { dg-do compile }
2
// { dg-options "-std=gnu++0x" }
3
 
4
// From N2235
5
 
6
// function template 1
7
template
8
  constexpr int bytesize(T t)
9
  { return sizeof (t); }        // OK
10
 
11
char buf[bytesize(0)];          // OK -- not C99 VLA
12
 
13
 
14
// function template 2
15
template
16
  constexpr _Tp
17
  square(_Tp x) { return x; }
18
 
19
// Explicit specialization
20
template<>
21
  constexpr unsigned long
22
  square(unsigned long x) { return x * x; }
23
 
24
// Explicit instantiation
25
template int square(int);
26
 
27
class A { };
28
template A square(A);
29
 
30
template long square(long);

powered by: WebSVN 2.1.0

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