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

            Bug ID: 70538
           Summary: deprecated "access declaration" evokes gcc_unreachable
                    ICE
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jim at meyering dot net
  Target Milestone: ---

While attempting to emit a diagnostic following this warning,

  x.ii:11:3: warning: access declarations are deprecated in favour of
using-declarations; suggestion: add the ‘using’ keyword [-Wdeprecated]

gcc reaches a gcc_unreachable call at gcc/cp/pt.c:17317:

17312         /* Look for the clone.  */
17313         FOR_EACH_CLONE (clone, spec)
17314           if (DECL_NAME (clone) == DECL_NAME (tmpl))
17315             return clone;
17316         /* We should always have found the clone by now.  */
17317         gcc_unreachable ();
17318         return NULL_TREE;

Here is a 'creduce'd input that triggers that error:

$ g++ --version|head -1 && cat x.ii && ./cc1plus x.ii
g++ (GCC) 6.0.0 20160405 (experimental)

struct A;
template <typename> class C;
using PathComponentPiece = C<int>;
class B {
  B(int);
  template <typename T> B(T);
  B(C<A>);
};
template <typename> class C : B {
  using base_type = B;
  base_type::base_type;
  PathComponentPiece m_fn1() {}
};

x.ii:11:3: warning: access declarations are deprecated in favour of
using-declarations; suggestion: add the ‘using’ keyword [-Wdeprecated]
   base_type::base_type;
   ^~~~~~~~~
x.ii: In substitution of ‘template<class T> C<A>::C(T) [with T = int]’:
x.ii:11:14:   recursively required by substitution of ‘template<class T>
C<A>::C(T) [with T = int]’
x.ii:11:14:   required from ‘class C<int>’
x.ii:12:30:   required from here
x.ii:11:14: internal compiler error: in instantiate_template_1, at
cp/pt.c:17317
   base_type::base_type;
              ^~~~~~~~~
0x62362a instantiate_template_1
        ../../gcc/cp/pt.c:17317
0x623a1c instantiate_template(tree_node*, tree_node*, int)
        ../../gcc/cp/pt.c:17449
0x624326 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, bool, bool)
        ../../gcc/cp/pt.c:17808
0x5d085d add_template_candidate_real
        ../../gcc/cp/call.c:3089
0x5d0fbc add_template_candidate
        ../../gcc/cp/call.c:3171
0x5d0fbc add_candidates
        ../../gcc/cp/call.c:5344
0x5ce443 build_user_type_conversion_1
        ../../gcc/cp/call.c:3687
0x5cee30 implicit_conversion
        ../../gcc/cp/call.c:1863
0x5d02b8 add_function_candidate
        ../../gcc/cp/call.c:2121
0x5d0f5f add_candidates
        ../../gcc/cp/call.c:5354
0x5d14f4 build_new_method_call_1
        ../../gcc/cp/call.c:8293
0x5d14f4 build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, tree_node*, int, tree_node**, int)
        ../../gcc/cp/call.c:8489
0x6b5bce locate_fn_flags
        ../../gcc/cp/method.c:900
0x6b65d8 synthesized_method_walk
        ../../gcc/cp/method.c:1477
0x6b6f54 deduce_inheriting_ctor(tree_node*)
        ../../gcc/cp/method.c:1711
0x61273c tsubst_decl
        ../../gcc/cp/pt.c:11941
0x614b94 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/cp/pt.c:12817
0x6238b5 instantiate_template_1
        ../../gcc/cp/pt.c:17398
0x623a1c instantiate_template(tree_node*, tree_node*, int)
        ../../gcc/cp/pt.c:17449
0x623480 instantiate_template_1
        ../../gcc/cp/pt.c:17307
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.

Reply via email to