Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: 64-bit Seattle 10: __property in derived template classes


This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 1 - Last Post: Dec 22, 2015 10:19 PM Last Post By: Roland Seidel
Roland Seidel

Posts: 6
Registered: 4/22/03
64-bit Seattle 10: __property in derived template classes  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 17, 2015 2:12 PM
The following code compiles fine in 32-bit but fails in 64-bit with "use of undeclared identifier 'Count'" when a derived class tries to use a __property from the parent

It compiles fine if the classes are not templates
It compiles fine in 32/64 in XE8 so something has changed in Seattle 10.
I can't find anything in the help - any clues?

template <class T> class Foo
{
private:
int FCount;
protected:
virtual void SetCount(int n)
{
FCount = n;
}
public:
__property int Count = {read=FCount, write = SetCount};
};

template <class T> class Bar : public Foo<T>
{
public:
int RoughCount(T t)
{
if(!Count) return 0; // Error: use of undeclared identifier 'Count'
return 7;
}
};

Roland Seidel

Posts: 6
Registered: 4/22/03
Re: 64-bit Seattle 10: __property in derived template classes  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 22, 2015 10:19 PM   in response to: Roland Seidel in response to: Roland Seidel
I got the solution from another source.

It needs to be
if(!this->Count) return 0;
with this-> to meet the C++ Two-Phase Lookup rule.

Roland Seidel wrote:
The following code compiles fine in 32-bit but fails in 64-bit with "use of undeclared identifier 'Count'" when a derived class tries to use a __property from the parent

It compiles fine if the classes are not templates
It compiles fine in 32/64 in XE8 so something has changed in Seattle 10.
I can't find anything in the help - any clues?

template <class T> class Foo
{
private:
int FCount;
protected:
virtual void SetCount(int n)
{
FCount = n;
}
public:
__property int Count = {read=FCount, write = SetCount};
};

template <class T> class Bar : public Foo<T>
{
public:
int RoughCount(T t)
{
if(!Count) return 0; // Error: use of undeclared identifier 'Count'
return 7;
}
};

Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02