This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/67021] New: [c++-concepts]


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67021

            Bug ID: 67021
           Summary: [c++-concepts]
           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 36062
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36062&action=edit
Test case

This program:

#include <type_traits>

template <class...>
struct all_same { static constexpr bool value = true; };
template <class T, class...Rest>
struct all_same<T, T, Rest...> : all_same<T, Rest...> {};
template <class T, class U, class...Rest>
struct all_same<T, U, Rest...> { static constexpr bool value = false; };

template <class...Us>
concept bool Same() {
  return all_same<Us...>::value;
}

template <class R>
using ValueType = int;

template <class I>
concept bool A() {
  return requires (I& i) {
    requires Same<ValueType<I>, ValueType<decltype(i++)>>();
  };
}

template <A>
  requires false
constexpr bool f() { return false; }
template <A>
constexpr bool f() { return true; }

int main() {
  static_assert(f<int>());
}

ICEs with:

~/concept-gcc/bin/g++ -std=gnu++1z foo3.cpp -c
foo3.cpp: In instantiation of âstruct all_same<ValueType<I>, ValueType<decltype
((i ++))> >â:
foo3.cpp:29:18:   required from here
foo3.cpp:8:56: internal compiler error: in finish_member_declaration, at
cp/semantics.c:2862
 struct all_same<T, U, Rest...> { static constexpr bool value = false; };
                                                        ^
0x772373 finish_member_declaration(tree_node*)
        ../../gcc/cp/semantics.c:2862
0x68321f instantiate_class_template_1
        ../../gcc/cp/pt.c:10028
0x68321f instantiate_class_template(tree_node*)
        ../../gcc/cp/pt.c:10237
0x720403 complete_type(tree_node*)
        ../../gcc/cp/typeck.c:138
0x7633c4 lookup_member(tree_node*, tree_node*, int, bool, int)
        ../../gcc/cp/search.c:1205
0x7c2de9 lookup_qualified_name(tree_node*, tree_node*, bool, bool)
        ../../gcc/cp/name-lookup.c:4532
0x65027b tsubst_qualified_id
        ../../gcc/cp/pt.c:13402
0x6524db tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../gcc/cp/pt.c:15491
0x64462e tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc/cp/pt.c:15092
0x8057df lift_function_definition
        ../../gcc/cp/constraint.cc:407
0x80488d lift_requires_expression
        ../../gcc/cp/constraint.cc:526
0x80488d lift_expression
        ../../gcc/cp/constraint.cc:558
0x805220 normalize_predicate_constraint
        ../../gcc/cp/constraint.cc:955
0x805220 normalize_constraint
        ../../gcc/cp/constraint.cc:993
0x805508 build_constraints(tree_node*, tree_node*)
        ../../gcc/cp/constraint.cc:1096
0x5af175 grokfndecl
        ../../gcc/cp/decl.c:7788
0x6208f6 grokdeclarator(cp_declarator const*, cp_decl_specifier_seq*,
decl_context, int, tree_node**)
        ../../gcc/cp/decl.c:11202
0x622066 start_function(cp_decl_specifier_seq*, cp_declarator const*,
tree_node*)
        ../../gcc/cp/decl.c:13964
0x710ce8 cp_parser_function_definition_from_specifiers_and_declarator
        ../../gcc/cp/parser.c:24317
0x710ce8 cp_parser_init_declarator
        ../../gcc/cp/parser.c:17632
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.

Here's where things get weird: despite the fact that nothing in the test case
refers to any entity in namespace std, removing "#include <type_traits>"
results in a correctly compiling program.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]