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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [template/] [dr408.C] - Blame information for rev 693

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
// DR 408
2
// { dg-do link }
3
 
4
// Test that a size given in the out-of-class definition isn't used until
5
// instantiation time.
6
template
7
struct X
8
{
9
  static char s[];
10
  int c;
11
};
12
 
13
template
14
char X::s[sizeof(X)];
15
 
16
#define sassert(EXP) int ar[(EXP)?1:-1]
17
sassert(sizeof (X::s) == sizeof (int));
18
 
19
// Test that a specialization can have a different size.
20
 
21
template  void g();
22
template <> void g<2>() { }
23
 
24
template 
25
struct S {
26
  static int i[];
27
  void f();
28
};
29
 
30
template 
31
int S::i[] = { 1 };
32
 
33
template 
34
void S::f() {
35
  g();
36
}
37
 
38
template <>
39
int S::i[] = { 1, 2 };
40
 
41
int main()
42
{
43
  S s;
44
  s.f();
45
}

powered by: WebSVN 2.1.0

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