https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58972
--- Comment #3 from Ville Voutilainen <ville.voutilainen at gmail dot com> --- [ville@localhost ~]$ g++ --std=c++11 -c dan.cpp dan.cpp: In instantiation of ‘struct derive<T>::foo(base::type) [with T = char; base::type = int]::f_t’: dan.cpp:18:5: required from ‘void derive<T>::foo(base::type) [with T = char; base::type = int]’ dan.cpp:26:11: required from here dan.cpp:4:15: error: ‘typedef int base::type’ is protected typedef int type; ^ dan.cpp:15:11: error: within this context f_t(type a) : a(a) {} ^ dan.cpp: In instantiation of ‘void derive<T>::foo(base::type) [with T = char; base::type = int]’: dan.cpp:26:11: required from here dan.cpp:18:10: internal compiler error: in instantiate_decl, at cp/pt.c:19746 } f(a); ^ 0x5c281f instantiate_decl(tree_node*, int, bool) ../../gcc/cp/pt.c:19745 0x638853 mark_used(tree_node*, int) ../../gcc/cp/decl2.c:5016 0x553bf3 build_over_call ../../gcc/cp/call.c:7325 0x55f470 build_new_method_call_1 ../../gcc/cp/call.c:8037 0x55f470 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:8107 0x560549 build_special_member_call(tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, tree_node*, int, int) ../../gcc/cp/call.c:7651 0x6bd6e9 expand_default_init ../../gcc/cp/init.c:1713 0x6bd6e9 expand_aggr_init_1 ../../gcc/cp/init.c:1814 0x6bfdac build_aggr_init(tree_node*, tree_node*, int, int) ../../gcc/cp/init.c:1566 0x57360c build_aggr_init_full_exprs ../../gcc/cp/decl.c:5642 0x57360c check_initializer ../../gcc/cp/decl.c:5777 0x58556c cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int) ../../gcc/cp/decl.c:6445 0x5c9700 tsubst_expr ../../gcc/cp/pt.c:13650 0x5c5d83 tsubst_expr ../../gcc/cp/pt.c:13538 0x5c6a13 tsubst_expr ../../gcc/cp/pt.c:13724 0x5c401b instantiate_decl(tree_node*, int, bool) ../../gcc/cp/pt.c:20036 0x5fce67 instantiate_pending_templates(int) ../../gcc/cp/pt.c:20152 0x63a29f cp_write_global_declarations() ../../gcc/cp/decl2.c:4348 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.