[Bug c++/67159] New: [c++concepts] Segfault while diagnosing constraint violation
Casey at Carter dot net
gcc-bugzilla@gcc.gnu.org
Sat Aug 8 20:07:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67159
Bug ID: 67159
Summary: [c++concepts] Segfault while diagnosing constraint
violation
Product: gcc
Version: c++-concepts
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: Casey at Carter dot net
Target Milestone: ---
Created attachment 36149
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36149&action=edit
Preprocessed test case
r226725 crashes while diagnosing a constraint violation in this correct program
(pre-processed test case attached):
#include <stl2/detail/iterator/concepts.hpp>
template <class T>
concept bool R = requires (T& t) {
{ t.begin() } -> stl2::Iterator;
{ t.end() } -> stl2::Sentinel<decltype(t.begin())>;
};
struct foo {
int* begin();
int* end();
};
R{T}
constexpr bool f() { return true; }
static_assert(f<foo>());
resulting in:
~/concept-gcc-r226725/bin/g++ -std=gnu++1z foo.i -c
foo.cpp:17:22: error: cannot call function ‘constexpr bool f() [with T = foo]’
static_assert(f<foo>());
^
foo.cpp:15:16: note: constraints not satisfied
constexpr bool f() { return true; }
^
‘
Segmentation fault
static_assert(f<foo>());
^
0xc9055f crash_signal
../../gcc/toplev.c:352
0xf0f506 contains_struct_check(tree_node const*, tree_node_structure_enum, char
const*, int, char const*)
../../gcc/tree.h:3227
0xf0f506 int_cst_value(tree_node const*)
../../gcc/tree.c:10982
0x6d03c4 get_non_default_template_args_count
../../gcc/cp/error.c:202
0x6da0b1 dump_template_argument_list
../../gcc/cp/error.c:211
0x6d52bd dump_decl
../../gcc/cp/error.c:1215
0x6dae15 expr_to_string
../../gcc/cp/error.c:2954
0x6dea54 cp_printer
../../gcc/cp/error.c:3530
0x13a309a pp_format(pretty_printer*, text_info*)
../../gcc/pretty-print.c:612
0x13a0573 diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*)
../../gcc/diagnostic.c:915
0x13a09d1 inform(unsigned int, char const*, ...)
../../gcc/diagnostic.c:1044
0x738a81 cp_build_function_call_vec(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
../../gcc/cp/typeck.c:3492
0x5f1e29 build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, bool, int)
../../gcc/cp/call.c:4090
0x77b850 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
../../gcc/cp/semantics.c:2391
0x6fa019 cp_parser_postfix_expression
../../gcc/cp/parser.c:6419
0x6fe92a cp_parser_unary_expression
../../gcc/cp/parser.c:7486
0x6ff53f cp_parser_binary_expression
../../gcc/cp/parser.c:8223
0x6ffc9f cp_parser_assignment_expression
../../gcc/cp/parser.c:8481
0x700115 cp_parser_constant_expression
../../gcc/cp/parser.c:8727
0x702a94 cp_parser_static_assert
../../gcc/cp/parser.c:12296
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
More information about the Gcc-bugs
mailing list