- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The following code causes a bogus warning:
~ > cat /tmp/main.cpp template <typename T> class Parent { class A {}; class B { friend class Parent<T>::A; }; }; ~ > icc -c /tmp/main.cpp /tmp/main.cpp(5): warning #135: class template "Parent<T>" has no member "A" friend class Parent<T>::A; ^
However it's perfectly legal C++ (AFAICT), and there are no warnings under either GCC 4.8.5 or Clang 3.7.0.
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes it looks like we inadvertently give a warning on the above.
We were trying to catch this case below -- which g++ and Clang allow without a warning:
g++ and Microsoft allow a friend declaration that refers to an undeclared
member of a prototype instantiation. For example:
template <class T> struct A {
struct B {
friend void A::f();
};
};
I have entered a bug report (DPD200380380) for us to distinguish between these two cases.
Thanks for letting us know.
Judy

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page