[prev in list] [next in list] [prev in thread] [next in thread]
List: gcc-bugs
Subject: Missing warning
From: Carlo Wood <carlo () runaway ! xs4all ! nl>
Date: 1999-09-25 23:58:57
[Download RAW message or body]
Hi, while implementing a singleton class, I ran into the
following weirdness:
The following code snippet doesn't give the warning that
one would expect:
-----------------------------------------------------------
template<class T> class B {
B(void);
public:
static void create(void) { new T; }
};
class A : public B<A> {
};
void foo(void)
{
A::create();
}
-----------------------------------------------------------
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/cpp -lang-c++ -v -undef -D__GNUC__=2 \
-D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=91 -D__ELF__ -Dunix -Di386 -D__i386__ \
-Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__i386__ -D__linux__ -D__unix -D__i386 \
-D__linux -Asystem(posix) -D__EXCEPTIONS -Asystem(unix) -Acpu(i386) -Amachine(i386) \
-Di386 -D__i386 -D__i386__ singleton.cc /tmp/ccr2vFEd.ii GNU CPP version egcs-2.91.66 \
19990314/Linux (egcs-1.1.2 release) (i386 Linux/ELF) #include "..." search starts \
here: #include <...> search starts here:
/usr/include/g++-2
/usr/local/include
/usr/i386-redhat-linux/include
/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include
/usr/include
End of search list.
/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/cc1plus /tmp/ccr2vFEd.ii -quiet \
-dumpbase singleton.cc -version -o /tmp/ccUwUNmg.s GNU C++ version egcs-2.91.66 \
19990314/Linux (egcs-1.1.2 release) (i386-redhat-linux) compiled by GNU C version \
egcs-2.91.66 19990314/Linux (egcs-1.1.2 release).
singleton.cc: In method `A::A()':
singleton.cc:4: confused by earlier errors, bailing out
The correct warning would be:
singleton.cc: In method `A::A()':
singleton.cc:2: `B<A>::B<A>()' is private
singleton.cc:4: within this context
--
Carlo Wood <carlo@runaway.xs4all.nl>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic