blob: d399a5f84a74b1d1125eae6605d11d4cd4bb1f9a (
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
|
// { dg-do run }
#include <string.h>
class SomeClass_t {
public:
SomeClass_t () : x (11) {}
protected:
float x;
};
class DynamicOnly_t {
public:
static DynamicOnly_t* create (const char* name = "UNDEF",
const SomeClass_t& somec = *(new SomeClass_t
())) {
return new DynamicOnly_t (name, somec);
}
DynamicOnly_t (const char* name, const SomeClass_t& somec) :
m_somec (somec) {
strncpy (m_Name, name, sizeof (m_Name));
}
private:
SomeClass_t m_somec;
char m_Name[255];
};
int main (int argc, char* argv[]) {
DynamicOnly_t* ptr = DynamicOnly_t::create ();
return 0;
}
|