[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc
Subject:    declaring partial template specialization a friend of enclosed class
From:       Carlo Wood <carlo () runaway ! xs4all ! nl>
Date:       1999-10-07 18:13:26
[Download RAW message or body]

Hiya,

is this illegal code?  If not, then it's a bug in egcs.

friend.cc:
-------------------------------------------
template<class T, int i>
class A {
  class I {
    friend A<T, i>;
  };
};

template<class T>
class A<T, -1> {
  class I {
    friend A<T, -1>;    // Not possible?
  };
};
-------------------------------------------

~/c++/tests>g++ -c friend.cc
friend.cc:11: partial specialization `A<T,-1>' declared `friend'

I've tried to find a reason for this in the standard, but I can not
find anything that would forbid this (I am not that good in finding
things in the standard though).

Regards,

-- 
 Carlo Wood  <carlo@runaway.xs4all.nl>

PS With `-v':

~/c++/tests>g++ -v -c friend.cc
Reading specs from /usr/lib/gcc-lib/i686-redhat-linux/2.95.1/specs
gcc version 2.95.1 19990816/Linux (release)
 /usr/lib/gcc-lib/i686-redhat-linux/2.95.1/cpp -lang-c++ -v -D__GNUC__=2 -D__GNUG__=2 \
-D__GNUC_MINOR__=95 -D__cplusplus -D__ELF__ -Dunix -D__i386__ -Dlinux -D__ELF__ \
-D__unix__ -D__i386__ -D__linux__ -D__unix -D__linux -Asystem(posix) -D__EXCEPTIONS \
-Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -Di686 -Dpentiumpro -D__i686 \
-D__i686__ -D__pentiumpro -D__pentiumpro__ friend.cc /tmp/cct7Kb7e.ii GNU CPP version \
2.95.1 19990816/Linux (release) (i386 Linux/ELF) #include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc-lib/i686-redhat-linux/2.95.1/../../../../include/g++-3
 /usr/local/include
 /usr/lib/gcc-lib/i686-redhat-linux/2.95.1/include
 /usr/include
End of search list.
The following default directories have been omitted from the search path:
 /usr/lib/gcc-lib/i686-redhat-linux/2.95.1/../../../../i686-redhat-linux/include
End of omitted list.
 /usr/lib/gcc-lib/i686-redhat-linux/2.95.1/cc1plus /tmp/cct7Kb7e.ii -quiet -dumpbase \
friend.cc -version -o /tmp/ccAWmcFn.s GNU C++ version 2.95.1 19990816/Linux (release) \
(i686-redhat-linux) compiled by GNU C version 2.95.1 19990816/Linux (release). \
friend.cc:11: partial specialization `A<T,-1>' declared `friend'


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic