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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [cpp0x/] [linkage2.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
// DR 743: A type without linkage shall not be used as the type of a
2
//     variable or function with linkage, unless
3
//   o the variable or function has extern "C" linkage (7.5 [dcl.link]), or
4
//   o the variable or function is not used (3.2 [basic.def.odr]) or is
5
//   defined in the same translation unit.
6
 
7
// { dg-options -std=c++0x }
8
 
9
template  struct B {
10
  void g(T){}
11
  void h(T);                    // { dg-error "never defined" }
12
  friend void i(B, T){}
13
  static T t1;                  // { dg-error "never defined" }
14
  static T t2;
15
};
16
 
17
template  T B::t2 = { };
18
 
19
enum {} e1;                     // OK, defined
20
extern enum {} e2;              // { dg-error "never defined" }
21
extern "C" enum {} e3;          // OK, extern "C"
22
 
23
void f() {
24
  struct A { int x; };  // no linkage
25
  A a = {1};
26
  B ba;              // declares B::g(A) and B::h(A)
27
  ba.t1 = a;            // error, B::t never defined
28
  ba.t2 = a;            // OK
29
  ba.g(a);              // OK
30
  ba.h(a);              // error, B::h never defined
31
  i(ba, a);             // OK
32
  e1+e2+e3;
33
}

powered by: WebSVN 2.1.0

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