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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [warn/] [Wnull-conversion-2.C] - Blame information for rev 715

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

Line No. Rev Author Line
1 693 jeremybenn
// { dg-do compile }
2
// { dg-options "-Wconversion-null" }
3
 
4
#include 
5
 
6
class Foo {
7
 public:
8
  template 
9
  static void Compare(const T1& expected, const T2& actual) { }
10
 
11
  template 
12
  static void Compare(const T1& expected, T2* actual) { }
13
 
14
};
15
 
16
template
17
class Foo2 {
18
 public:
19
  Foo2(int x);
20
  template void Bar(T2 y);
21
};
22
 
23
template void func(T3 x) { }
24
 
25
typedef Foo2 MyFooType;
26
 
27
void func1(long int a) {
28
  MyFooType *foo2 = new MyFooType(NULL); // { dg-warning "passing NULL to" }
29
  foo2->Bar(a);
30
  func(NULL);
31
  func(NULL);                       // { dg-warning "passing NULL to" }
32
  func(NULL);
33
}
34
 
35
int x = 1;
36
 
37
main()
38
{
39
  int *p = &x;
40
 
41
  Foo::Compare(0, *p);
42
  Foo::Compare(NULL, p);  // { dg-warning "passing NULL to" }
43
  Foo::Compare(NULL, p);
44
  func1(NULL);                           // { dg-warning "passing NULL to" }
45
}

powered by: WebSVN 2.1.0

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