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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.dg/] [template/] [error10.C] - Blame information for rev 237

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

Line No. Rev Author Line
1 149 jeremybenn
// { dg-do compile }
2
// Origin: 
3
// c++/9154: poor error message for ">>" vs "> >" in template argument list
4
 
5
 
6
/*
7
 * Test that the error message is issued properly
8
 */
9
template 
10
class A {};
11
 
12
A> blah;  // { dg-error "should be '> >' within" }
13
A> blah2; // { dg-error "spurious '>>'" }
14
 
15
 
16
/*
17
 * Test that a few valid constructs containing a ">>" token in a
18
 * template argument list are handled correctly.
19
 */
20
template 
21
void B(void) {}
22
 
23
int Btest()
24
{
25
  B<256 >> 4>();
26
}
27
 
28
template >4>
29
struct C {};
30
 
31
template       struct D {};
32
template  struct E {};
33
 
34
E>2 > > E1;
35
 
36
const int x = 0;
37
E>x > > E2;
38
 
39
template  struct F {
40
  typedef int I;
41
};
42
 
43
template >2 >::I>
44
struct G {};
45
 
46
/*
47
 * In this special case, a valid type-id (H() is a function type) is followed
48
 * by '>>', but the argument should still be parsed as an expression, which
49
 * will then be rejected as non-constant expression.
50
 */
51
struct H
52
{
53
  int operator >>(int);
54
};
55
 
56
template  struct L {};
57
L> 5> l;  // { dg-error "" "non-constant" }
58
 
59
 
60
/*
61
 * This case used to not emit the nice error message because of a typo
62
 *  in the code.
63
 */
64
template 
65
struct K {};
66
 
67
void KFunc(void);
68
 
69
A> k1;  // { dg-error "" }
70
K<&KFunc>> k2; // { dg-error "" }

powered by: WebSVN 2.1.0

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