Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » Curious problem wth Vector
Curious problem wth Vector [message #49641] Tue, 20 March 2018 13:17 Go to next message
koldo is currently offline  koldo
Messages: 3356
Registered: August 2008
Senior Veteran
Hello all

I have found a weird problem. Declaring this class:
struct MyData : public Moveable<MyData> {
	MyData() {}

	double T;	
};

And declaring Vector<MyData> data; produces an error message in MSC15 and 17 (not in MinGW):
error C2523: 'Unit::~T': destructor tag mismatch

The code when the error is found is:
template <class T>
inline void Destroy(T *t, const T *end)
{
	while(t != end) {
		t->T::~T(); // HERE
		t++;
	}
}

In some way, the name of variable double "T" clashes with template name "T"...


Best regards
Iñaki

[Updated on: Tue, 20 March 2018 13:18]

Report message to a moderator

Re: Curious problem wth Vector [message #49644 is a reply to message #49641] Wed, 21 March 2018 08:12 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3356
Registered: August 2008
Senior Veteran
I mean, if variable would be "t" instead of "T", no problem Smile

Best regards
Iñaki
Re: Curious problem wth Vector [message #49646 is a reply to message #49644] Wed, 21 March 2018 13:44 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1092
Registered: August 2007
Senior Contributor
Try -Wall with GCC/MinGW, you'll probably get the warnings (I haven't tested, TBH).

Seems like a variant of template parameter hiding issue to me.

http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html# 459

Best regards,
Oblivion


[Updated on: Wed, 21 March 2018 13:47]

Report message to a moderator

Re: Curious problem wth Vector [message #49656 is a reply to message #49646] Thu, 22 March 2018 11:51 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Fixed.
Previous Topic: how to convert unicode to String
Next Topic: DST issue in Time()
Goto Forum:
  


Current Time: Fri Apr 19 12:48:49 CEST 2024

Total time taken to generate the page: 0.03061 seconds