[Bug c++/17232] New: classes and class template specializations treated differently w.r.t. core issue #337
cludwig at cdc dot informatik dot tu-darmstadt dot de
gcc-bugzilla@gcc.gnu.org
Sun Aug 29 17:55:00 GMT 2004
cludwig@lap200:~/C++/gcc3.4/tmp> LC_ALL=C g++ -v
Reading specs from /opt/gcc/gcc-3.4.1/lib/gcc/i686-pc-linux-gnu/3.4.1/specs
Configured with: ../gcc-3.4.1/configure --prefix=/opt/gcc/gcc-3.4.1
--enable-threads=posix --enable-version-specific-runtime-libs
--enable-languages=c,c++ --enable-__cxa_atexit --enable-c-mbchar
--enable-concept-checks --enable-libstdcxx-debug --enable-c99
--enable-libstdcxx-pch
Thread model: posix
gcc version 3.4.1
cludwig@lap200:~/C++/gcc3.4/tmp> cat ./is_abstract_test.cc
template<typename T>
class A {
virtual void f() = 0;
};
class B {
virtual void f() = 0;
};
template<typename T>
int g(T (*)[1]) {
return 0;
}
template<typename T>
int g(...) {
return 1;
}
int main() {
return (g< A<int> >(0) == g< B >(0)) ;
}
cludwig@lap200:~/C++/gcc3.4/tmp> ./is_abstract_test ; echo $?
0
According to http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/cwg_defects.html#337,
type deduction fails if it implies constructing an array of an abstract class.
(This enables traits like boost::is_abstract<T>::value.) Therefore, above
program is supposed to choose for both g< A<int> >() and g<B>() the second
overload (the one that returns 1), whence the program's return value should be
non-zero.
However, g++ 3.4.1 chooses the first overload for g< A<int> >().
Regards
Christoph
--
Summary: classes and class template specializations treated
differently w.r.t. core issue #337
Product: gcc
Version: 3.4.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: cludwig at cdc dot informatik dot tu-darmstadt dot de
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17232
More information about the Gcc-bugs
mailing list