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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [enum-compat-1.c] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* Test that enumerated types are only considered compatible when they
2
   are the same type.  PR c/6024.  */
3
/* Origin: Joseph Myers <jsm@polyomino.org.uk>, based on
4
   PR c/6024 from Richard Earnshaw <rearnsha@arm.com> */
5
/* { dg-do compile } */
6
/* { dg-options "" } */
7
 
8
/* Original test from PR c/6024.  */
9
enum e1 {a, b};
10
enum e2 {c, d};
11
 
12
void f(enum e1); /* { dg-error "prototype" "error at decl" } */
13
 
14
void f(x)
15
     enum e2 x;
16
{ /* { dg-error "doesn't match prototype" "error at defn" } */
17
  return;
18
}
19
 
20
/* Other compatibility tests.  */
21
enum e3 { A };
22
enum e4 { B };
23
 
24
enum e3 v3;
25
enum e4 *p = &v3; /* { dg-warning "incompatible" "incompatible pointer" } */
26
enum e3 *q = &v3;
27
 
28
void g(enum e3); /* { dg-error "declaration" "error at first decl" } */
29
void g(enum e4); /* { dg-error "conflicting types" "error at second decl" } */
30
 
31
void h(enum e3);
32
void h(enum e3);

powered by: WebSVN 2.1.0

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