[Bug c++/61228] New: noexcept(expression) causes internal compiler error
igorkuo at meta dot ua
gcc-bugzilla@gcc.gnu.org
Mon May 19 11:35:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61228
Bug ID: 61228
Summary: noexcept(expression) causes internal compiler error
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: igorkuo at meta dot ua
The following code
# include <cctype>
# include <algorithm>
template<int (& F)(int)>
constexpr int safeCtype(unsigned char c) noexcept(noexcept(F(c)))
{ return F(c); }
int main()
{
const char t[] = "a";
//safeCtype<std::isspace>(*t);
std::find_if(t, t + 1, safeCtype<std::isspace>);
}
compiled with
$ g++ noexcept_bug.cpp -std=c++11
produces output:
In file included from /usr/include/c++/4.9.0/bits/stl_algobase.h:71:0,
from /usr/include/c++/4.9.0/algorithm:61,
from noexcept_bug.cpp:2:
/usr/include/c++/4.9.0/bits/predefined_ops.h: In instantiation of ‘bool
__gnu_cxx::__ops::_Iter_pred<_Predicate>::operator()(_Iterator) [with _Iterator
= const char*; _Predicate = int (*)(unsigned char) noexcept
(<uninstantiated>)]’:
/usr/include/c++/4.9.0/bits/stl_algo.h:120:22: required from
‘_RandomAccessIterator std::__find_if(_RandomAccessIterator,
_RandomAccessIterator, _Predicate, std::random_access_iterator_tag) [with
_RandomAccessIterator = const char*; _Predicate =
__gnu_cxx::__ops::_Iter_pred<int (*)(unsigned char) noexcept
(<uninstantiated>)>]’
/usr/include/c++/4.9.0/bits/stl_algo.h:162:43: required from ‘_Iterator
std::__find_if(_Iterator, _Iterator, _Predicate) [with _Iterator = const char*;
_Predicate = __gnu_cxx::__ops::_Iter_pred<int (*)(unsigned char) noexcept
(<uninstantiated>)>]’
/usr/include/c++/4.9.0/bits/stl_algo.h:3804:45: required from ‘_IIter
std::find_if(_IIter, _IIter, _Predicate) [with _IIter = const char*; _Predicate
= int (*)(unsigned char) noexcept (<uninstantiated>)]’
noexcept_bug.cpp:11:51: required from here
/usr/include/c++/4.9.0/bits/predefined_ops.h:231:30: internal compiler error:
in nothrow_spec_p, at cp/except.c:1271
{ return bool(_M_pred(*__it)); }
^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.archlinux.org/> for instructions.
Internal compiler error is produced by g++4.7.2(Debian), g++4.8.2(Mageia),
g++4.9.0(Manjaro).
If "noexcept(noexcept(F(c)))" is replaced with "noexcept" OR
"safeCtype<std::isspace>(*t);" is uncommented, compilation succeeds.
More information about the Gcc-bugs
mailing list