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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

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