Quantcast
Channel: Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1616

Calling parent's method in constructor, with templates

$
0
0

Hi,

I've encountered something strange when calling a parent's method inside a constructor. If the class and the parent are templates, I get "error: identifier "go" is undefined" message. A minimal code example (tested with "icc (ICC) 14.0.1 20131008"):

template<typename T>
struct boom
{
	void go() {}
};

template<typename T>
struct boom2 : public boom<T>
{
	boom2()
	{
		go();
	}
};

boom2<int> aaa;

Without the templates, it works. It can also be fixed by replacing go() with this->go(), so it is not a big issue for me. But it makes me wonder, whether my code is correct. As far as I know, it should be, but I'm not really familiar with all the details of the C++ standard.


Viewing all articles
Browse latest Browse all 1616

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>