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/] [parse/] [error11.C] - Blame information for rev 154

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
// { dg-do compile }
2
// Origin: Giovanni Bajo 
3
// Try to find out when the digraph '<:' is used as a mistake, and parse it
4
//  correctly to avoid cascaded errors.
5
 
6
struct B;
7
 
8
template 
9
struct Foo
10
{
11
  template 
12
  struct Nested
13
  {
14
    static void method(void) {}
15
  };
16
 
17
  void method(void) {
18
    typename Foo<::B>::template Nested<::B> n; // { dg-error "cannot begin|alternate spelling" }
19
    n.template Nested::method();
20
    n.template Nested<::B>::method();  // { dg-error "cannot begin|alternate spelling" }
21
    Nested::method();
22
    Nested<::B>::method(); // { dg-error "cannot begin|alternate spelling" }
23
  }
24
};
25
 
26
template  struct Foo2 {};
27
template struct Foo2<::B>;  // { dg-error "cannot begin|alternate spelling|type/value mismatch|expected a constant" }
28
 
29
int value = 0;
30
 
31
void func(void)
32
{
33
  Foo<::B> f; // { dg-error "cannot begin|alternate spelling" }
34
  f.Foo::method();
35
  f.Foo<::B>::method(); // { dg-error "cannot begin|alternate spelling" }
36
 
37
  // Check cases where we the token sequence is the correct one, but there
38
  //  was no digraph or whitespaces in the middle, so we should not emit
39
  //  the special error message.
40
  Foo<: :B> k2;     // { dg-bogus "cannot begin|alternate spelling" "smart error should not be triggered here" }
41
  Foo[:B> k1;       // { dg-bogus "cannot begin|alternate spelling" "smart error should not be triggered here" }
42
// { dg-error "" "" { target *-*-* } 40 }
43
// { dg-error "" "" { target *-*-* } 41 }
44
 
45
  int Foo[2];
46
  Foo[::value] = 0;
47
}
48
 
49
template struct Foo<::B>; // { dg-error "cannot begin|alternate spelling" }
50
 
51
// On the first error message, an additional note about the use of
52
//  -fpermissive should be present
53
// { dg-error "-fpermissive" "-fpermissive" { target *-*-* } 18 }

powered by: WebSVN 2.1.0

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