The attached preprocessed testcase results in an internal compiler error: /home/gaunard/dev/boost/trunk/boost/type_traits/detail/cv_traits_impl.hpp:36:1: internal compiler error: in finish_member_declaration, at cp/semantics.c:2559 This seems to be tied to the use of the may_alias attribute.
Testcase is here (couldn't attach it due to bugzilla size restrictions): http://mathias.gaunard.com/data/ice_finish_member_declaration.cpp
That you couldn't attach it should tell you something... Please do your best to reduce its size: http://gcc.gnu.org/wiki/A_guide_to_testcase_reduction
Created attachment 25562 [details] Reduced testcase Original testcase reduced using automated delta tools
Created attachment 25977 [details] smaller test case
Created attachment 25997 [details] smaller again
I've had this happen with 4.7.1 without any may_alias involved. Why is this bug still marked 'waiting'? Are more testcases necessary?
Became "Waiting" with Comment #2 and then nobody updated the status, it's as simple as that.
Although if you have a testcase without may_alias, you should attach it.
I assume I hit the same issue. I got the testcase down to a few lines: #include <type_traits> template <typename L> typename std::remove_reference<L>::type foo(L &&lhs, int rhs); template <typename T> T d(T i) { enum { Size = sizeof(int) }; return foo(i, Size); } template <typename T> struct A { typedef int TA __attribute__((__may_alias__)); }; int main() { typedef A<int> V; typedef typename std::remove_reference<typename V::TA &>::type T; return d(1); } It only needs the -std=c++11 flag. Tested to fail: 4.8.0/1/2/3 and 4.9.0/1/2 (4.9.2 is 20140924). Backtrace from 4.9.2 snapshot: /opt/gcc-4.9-snapshot/include/c++/4.9.2/type_traits:1488:5: internal compiler error: in finish_member_declaration, at cp/semantics.c:2827 { typedef _Tp type; }; ^ 0x6395c0 finish_member_declaration(tree_node*) ../.././gcc/cp/semantics.c:2827 0x5b975d instantiate_class_template_1 ../.././gcc/cp/pt.c:9244 0x5b975d instantiate_class_template(tree_node*) ../.././gcc/cp/pt.c:9445 0x61039d complete_type(tree_node*) ../.././gcc/cp/typeck.c:134 0x5a8531 tsubst(tree_node*, tree_node*, int, tree_node*) ../.././gcc/cp/pt.c:12163 0x5acac7 tsubst_function_type ../.././gcc/cp/pt.c:11344 0x5a7e7f tsubst(tree_node*, tree_node*, int, tree_node*) ../.././gcc/cp/pt.c:12081 0x5ae8fe tsubst_decl ../.././gcc/cp/pt.c:10596 0x5a822f tsubst(tree_node*, tree_node*, int, tree_node*) ../.././gcc/cp/pt.c:11543 0x5b09fb instantiate_template_1 ../.././gcc/cp/pt.c:15580 0x5b09fb instantiate_template(tree_node*, tree_node*, int) ../.././gcc/cp/pt.c:15630 0x5b6c2e 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:15979 0x574031 add_template_candidate_real ../.././gcc/cp/call.c:2998 0x571984 add_template_candidate ../.././gcc/cp/call.c:3095 0x571984 add_candidates ../.././gcc/cp/call.c:5169 0x5755d9 perform_overload_resolution ../.././gcc/cp/call.c:3904 0x5770ea build_new_function_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool, int) ../.././gcc/cp/call.c:3981 0x639891 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool, bool, int) ../.././gcc/cp/semantics.c:2358 0x5a1b34 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../.././gcc/cp/pt.c:14861 0x5a519c tsubst_expr ../.././gcc/cp/pt.c:14048
markus@x4 tmp % cat finish.ii template <typename> struct B; template <typename _Tp> struct B<_Tp &> { typedef _Tp type; }; template <typename L> typename B<L>::type foo(L &&); int a; struct A { typedef int TA __attribute__((__may_alias__)); }; void d() { foo(a); } int main() { B<A::TA &> b; } markus@x4 tmp % g++ -std=c++11 finish.ii finish.ii: In instantiation of ‘struct B<int&>’: finish.ii:15:25: required from here finish.ii:4:17: internal compiler error: in finish_member_declaration, at cp/semantics.c:2844
GCC 4.8.4 has been released.
This is related to the fix for bug 18174, which made int& a different type from A::TA&. But this difference is not reflected in the mangling, so B<int&> and B<A::TA&> have the same mangling, which we can't allow. The compiler tries to handle this by stripping attributes from template arguments, so that B<A::TA&> is treated as B<int&>. This was failing in this case because the middle end was giving the two types different TYPE_CANONICAL. I guess we need to work harder at stripping the attributes.
Author: jason Date: Thu Apr 23 15:55:21 2015 New Revision: 222377 URL: https://gcc.gnu.org/viewcvs?rev=222377&root=gcc&view=rev Log: PR c++/50800 * tree.c (strip_typedefs): Add remove_attributes parm. (strip_typedefs_expr): Likewise. (apply_identity_attributes): New subroutine of strip_typedefs. * pt.c (canonicalize_type_argument): Let strip_typedefs handle attrs. (convert_nontype_argument, unify): Likewise. * cp-tree.h: Adjust. Added: trunk/gcc/testsuite/g++.dg/ext/attrib50.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/cp-tree.h trunk/gcc/cp/pt.c trunk/gcc/cp/tree.c trunk/gcc/testsuite/g++.dg/abi/mangle40.C trunk/gcc/testsuite/g++.dg/ext/alias-canon2.C trunk/gcc/testsuite/g++.dg/ext/alias-mangle.C
Author: jason Date: Fri Apr 24 19:11:45 2015 New Revision: 222419 URL: https://gcc.gnu.org/viewcvs?rev=222419&root=gcc&view=rev Log: PR c++/50800 gcc/ * tree.c (build_reference_type_for_mode): Don't pass can_alias_all down when building TYPE_CANONICAL. (build_pointer_type_for_mode): Likewise. gcc/cp/ * typeck.c (structural_comptypes): Don't check TYPE_REF_CAN_ALIAS_ALL. Modified: trunk/gcc/ChangeLog trunk/gcc/cp/ChangeLog trunk/gcc/cp/typeck.c trunk/gcc/tree.c
Author: jason Date: Fri Apr 24 20:53:28 2015 New Revision: 222426 URL: https://gcc.gnu.org/viewcvs?rev=222426&root=gcc&view=rev Log: PR c++/50800 * g++.dg/ext/alias-canon2.C: Remove clashing fn definitions. Modified: trunk/gcc/testsuite/g++.dg/ext/alias-canon2.C
Author: jason Date: Tue Apr 28 14:43:54 2015 New Revision: 222530 URL: https://gcc.gnu.org/viewcvs?rev=222530&root=gcc&view=rev Log: PR c++/50800 * tree.c (strip_typedefs): Add remove_attributes parm. (strip_typedefs_expr): Likewise. (apply_identity_attributes): New subroutine of strip_typedefs. * pt.c (canonicalize_type_argument): Let strip_typedefs handle attrs. (convert_nontype_argument, unify): Likewise. * cp-tree.h: Adjust. Added: trunk/gcc/testsuite/g++.dg/ext/attrib50.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/cp-tree.h trunk/gcc/cp/pt.c trunk/gcc/cp/tree.c trunk/gcc/testsuite/g++.dg/abi/mangle40.C trunk/gcc/testsuite/g++.dg/ext/alias-mangle.C
Author: jason Date: Wed Apr 29 20:51:05 2015 New Revision: 222591 URL: https://gcc.gnu.org/viewcvs?rev=222591&root=gcc&view=rev Log: PR c++/50800 * tree.c (apply_identity_attributes): Fix handling of classes. Added: trunk/gcc/testsuite/g++.dg/cpp0x/alignas3.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/tree.c
*** Bug 57472 has been marked as a duplicate of this bug. ***
Hi everyone, I just got a similar output on GCC 5.1.0. I think it might be related, however this appears to be for different syntax. Flags are: "-mavx -std=c++11 -Wfatal-errors -O0" Please let me know if you still need a test case. .../BOOST/boost_1_57_0/boost/type_traits/remove_reference.hpp:42:1: note: in expansion of macro ‘BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1’ BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_reference,T&,T) ^ 0x6ef1fc finish_member_declaration(tree_node*) ../../gcc/cp/semantics.c:2872 0x66af2d instantiate_class_template_1 ../../gcc/cp/pt.c:9487 0x66af2d instantiate_class_template(tree_node*) ../../gcc/cp/pt.c:9688 0x6c5bed complete_type(tree_node*) ../../gcc/cp/typeck.c:146 0x653e5f tsubst(tree_node*, tree_node*, int, tree_node*) ../../gcc/cp/pt.c:12441 0x65e759 tsubst_template_args ../../gcc/cp/pt.c:10257 0x65ec84 tsubst_aggr_type ../../gcc/cp/pt.c:10454 0x653891 tsubst(tree_node*, tree_node*, int, tree_node*) ../../gcc/cp/pt.c:11909 0x66b909 instantiate_class_template_1 ../../gcc/cp/pt.c:9275 0x66b909 instantiate_class_template(tree_node*) ../../gcc/cp/pt.c:9688 0x6c5bed complete_type(tree_node*) ../../gcc/cp/typeck.c:146 0x653e5f tsubst(tree_node*, tree_node*, int, tree_node*) ../../gcc/cp/pt.c:12441 0x6519e1 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../gcc/cp/pt.c:14654 0x6514e5 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../gcc/cp/pt.c:15066 0x653320 tsubst(tree_node*, tree_node*, int, tree_node*) ../../gcc/cp/pt.c:12530 0x660c02 tsubst_decl ../../gcc/cp/pt.c:11339 0x653c54 tsubst(tree_node*, tree_node*, int, tree_node*) ../../gcc/cp/pt.c:11830 0x66aed2 instantiate_class_template_1 ../../gcc/cp/pt.c:9424 0x66aed2 instantiate_class_template(tree_node*) ../../gcc/cp/pt.c:9688 0x6c5bed complete_type(tree_node*) ../../gcc/cp/typeck.c:146
Fixed in GCC 6.