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