Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

warning #819 ???

cathune2
Beginner
501 Views
Hello,

I'm encountering this warning:


w819test.cpp(8): warning #819: template nesting depth does not match the previous declaration of class template "A::B [with T1=int]"
friend class B;
^
detected during instantiation of class "A::B [with T1=int, T2=int]" at line 14


when compiling this little piece of code:

[cpp]template< class T1 >
struct A
{
template< class T2 >
class B
{
template< class T3 >
friend class B;
};
};

int main()
{
A< int >::B< int > a;

return 0;
}
[/cpp]

Has anybody an idea about the point of this waring?
It seems as if icpc complains about A::B not being the same as A::B. If so this warning is completetly
meaningless I would think. Anyway: is there a clean way of getting rid of it (except using -wd819)?

By the way: the warning vanishes if I change A into an non-template struct and g++ does not complain at all.

cathune
0 Kudos
3 Replies
Lingfeng_C_Intel
Employee
501 Views
Hi Cathune,

I have a question, why do you define friend class B is itself? If class B has itself friend class, how about template in calss B?

Thanks,
Wise
0 Kudos
Brandon_H_Intel
Employee
501 Views
Hi, this looks like a legitimate question. EDG*, which is the basis we use for our front-end, thought the C++ standard said something about friend template declarations needing to match the template parameter specification of the named entity. However, they are reviewing whether their initial interpretation is actually correct, and will get back to us. I've linked this thread to our internal problem report on this, and when we hear anything, I'll update the thread.
0 Kudos
Brandon_H_Intel
Employee
501 Views

This warning no longer appears in the version 15.0 of the compiler now available with the Intel® Parallel Studio XE 2015 product line. Let us know if you need anything else.

0 Kudos
Reply