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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.old-deja/] [g++.law/] [cvt2.C] - Blame information for rev 779

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

Line No. Rev Author Line
1 305 jeremybenn
// { dg-do run  }
2
// GROUPS passed conversions
3
#include 
4
#include 
5
#include 
6
#include 
7
#include 
8
 
9
class cvec {
10
public:
11
        ~cvec(){ delete s; }
12
        cvec(const char*x) { s = new char[std::strlen(x)+1]; std::strcpy(s, x); }
13
        cvec(const cvec& c) { s = new char[std::strlen(c.s)+1]; std::strcpy(s, c.s); }
14
        operator const char*() { return s; }
15
private:
16
        char *s;
17
};
18
 
19
cvec
20
B(const char* a)
21
{
22
        return a;
23
}
24
 
25
void
26
A(const char* s)
27
{
28
        // s still ok here
29
        std::ifstream inf(s);
30
        if (std::strncmp ("aaa", s, 3))
31
          {
32
            std::printf ("FAIL\n");
33
            std::exit (1);
34
          }
35
        else
36
          std::printf ("PASS\n");
37
}
38
 
39
int main()
40
{
41
        A(B("aaa"));
42
}

powered by: WebSVN 2.1.0

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