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

Subversion Repositories openrisc

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

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

Line No. Rev Author Line
1 693 jeremybenn
// { dg-do compile }
2
 
3
// Copyright (C) 2001 Free Software Foundation, Inc.
4
// Contributed by Nathan Sidwell 15 Dec 2001 
5
 
6
// PR 2645
7
 
8
template 
9
struct call_traits
10
{
11
  public:
12
  typedef T type_less_spec;
13
};
14
 
15
template 
16
struct call_traits
17
{
18
  typedef T type_more_spec;
19
};
20
 
21
 
22
int main()
23
{
24
  int num;
25
 
26
   // Two typedefs lead to the instant. of the less spec. ("wrong") template
27
  typedef int& r_type;
28
  typedef const r_type cr_type;
29
  call_traits::type_less_spec var  = num; // { dg-error "" "" }
30
 
31
   // The explicit type leads to the instantiation of the "correct" one
32
  call_traits::type_more_spec var2 = num;
33
 
34
   // As happen with a single typedef!
35
  typedef const int& std_cr_type;
36
  call_traits::type_more_spec var3 = num;
37
 
38
 
39
   // As happen, indeed, without the cv-qualifier
40
  call_traits::type_more_spec var4;
41
}

powered by: WebSVN 2.1.0

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