[Bug c++/28225] New: [4.0/4.1/4.2 regression] segfault in type_dependent_expression_p
[ Forwarded from http://bugs.debian.org/376148 ]
The following bug has been reported by Alexei Sheplyakov who submitted a
testcase which shows a segfault with gcc 4.0, 4.1 and 4.2. gcc 3.4 produces an
error:
(sid)1311:tbm@reyes: ~] g++-4.0 -c test.cc
test.cc: In member function 'void foo<T1>::operator()(T1&, T3&)':
test.cc:14: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
For Debian GNU/Linux specific bug reporting instructions,
see <URL:file:///usr/share/doc/gcc-4.0/README.Bugs>.
zsh: exit 1 g++-4.0 -c test.cc
(sid)1312:tbm@reyes: ~] g++-4.1 -c test.cc
test.cc: In member function 'void foo<T1>::operator()(T1&, T3&)':
test.cc:14: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
For Debian GNU/Linux specific bug reporting instructions,
see <URL:file:///usr/share/doc/gcc-4.1/README.Bugs>.
Preprocessed source stored into /tmp/ccj3KtQL.out file, please attach this to
your bugreport.
zsh: exit 1 g++-4.1 -c test.cc
(sid)1313:tbm@reyes: ~] g++-3.4 -c test.cc
test.cc: In member function 'void foo<T1>::operator()(T1&, T3&)':
test.cc:14: error: non-constant 'foo<T1>::N_BC' cannot be used as template
argument
test.cc:14: error: template argument 3 is invalid
test.cc:14: error: invalid type in declaration before '(' token
zsh: exit 1 g++-3.4 -c test.cc
(sid)1314:tbm@reyes: ~]
(sid)1314:tbm@reyes: ~] cat test.cc
template<typename T> struct size_traits;
template<typename T, unsigned N> struct same_size_p;
template<typename T1> struct foo {
static const unsigned N_BC = size_traits<T1>::Size;
template<typename T2, unsigned N,
bool pred = same_size_p<T2, N_BC>::value > struct bar;
template<typename T2, unsigned N> struct bar<T2, N, true> {
static void apply(const T1& x, T2& y) { }
};
template<typename T3> void operator()(T1& a, T3& b) {
bar<T3, N_BC>::apply(a, b); // will get an ICE here
// Here is a work-around:
//bar<T3, N_BC, same_size_p<T3, N_BC>::value>::apply(a, b);
}
};
--
Summary: [4.0/4.1/4.2 regression] segfault in
type_dependent_expression_p
Product: gcc
Version: 4.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tbm at cyrius dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28225
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
Reply to: