error C2440: 'return' : cannot convert from 'class RawTestData (__cdecl *)(void)' to 'class RawTestData &'

skywarddoc.h(328) : error C2440: 'return' : cannot convert from 'class RawTestData (__cdecl *)(void)' to 'class RawTestData &'
A reference that is not to 'const' cannot be bound to a non-lvalue


Hi,

I am getting the subject error from this function declaration/inline implementation:
1
2
3
4
5
6
7
8
9
10
11
// Skyward document class
class CSkywardDoc : public CDocument
{
	DECLARE_DYNCREATE(CSkywardDoc)
...

        static RawTestData m_RawTestData();
...
        RawTestData &GetRawTestData() {return m_RawTestData; } //<-- error
...
}


Here's the class:

1
2
3
4
5
6
7
8
9
10
11
12
//data for a complete photometry test
class RawTestData : public CObject
{
DECLARE_SERIAL( RawTestData )

//...

public:

	RawTestData();
	virtual ~RawTestData();
};


This was just working, but then I added some code with failed, removed that code, and now I'm getting this error....argh!

Thanks for any help



EDIT:

it's also giving this related error in

...skywarddoc.cpp(224) : error C2350: 'CSkywardDoc::m_RawTestData' is not a static member


RawTestData CSkywardDoc::m_RawTestData;
Last edited on
static RawTestData m_RawTestData();

You're declaring it as a function. Get rid of those parenthesis.
Topic archived. No new replies allowed.