From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18761 invoked by alias); 15 Feb 2014 21:10:58 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 18740 invoked by uid 48); 15 Feb 2014 21:10:54 -0000 From: "reichelt at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/60216] New: [4.8/4.9 Regression] [c++11] Trouble with deleted template functions Date: Sat, 15 Feb 2014 21:10:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: accepts-invalid, ice-on-invalid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: reichelt at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-02/txt/msg01425.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60216 Bug ID: 60216 Summary: [4.8/4.9 Regression] [c++11] Trouble with deleted template functions Product: gcc Version: 4.9.0 Status: UNCONFIRMED Keywords: accepts-invalid, ice-on-invalid-code Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: reichelt at gcc dot gnu.org The following invalid code snippet (compiled with "-std=c++11") triggers an ICE since GCC 4.8.1: ============================================ struct A { template A(T) = delete; }; template<> A::A(int) {} A a(0); ============================================ bug.cc:8:6: error: use of deleted function 'A::A(T) [with T = int]' A a(0); ^ bug.cc:8:6: internal compiler error: in maybe_explain_implicit_delete, at cp/method.c:1422 0x7177c2 maybe_explain_implicit_delete(tree_node*) ../../gcc/gcc/cp/method.c:1422 0x6871f8 mark_used(tree_node*, int) ../../gcc/gcc/cp/decl2.c:4656 0x5b1349 build_over_call ../../gcc/gcc/cp/call.c:7188 0x5b3d0a build_new_method_call_1 ../../gcc/gcc/cp/call.c:7887 0x5b3d0a build_new_method_call(tree_node*, tree_node*, vec**, tree_node*, int, tree_node**, int) ../../gcc/gcc/cp/call.c:7957 0x5b4d79 build_special_member_call(tree_node*, tree_node*, vec**, tree_node*, int, int) ../../gcc/gcc/cp/call.c:7513 0x7080e9 expand_default_init ../../gcc/gcc/cp/init.c:1677 0x7080e9 expand_aggr_init_1 ../../gcc/gcc/cp/init.c:1778 0x70adf3 build_aggr_init(tree_node*, tree_node*, int, int) ../../gcc/gcc/cp/init.c:1529 0x5c7454 build_aggr_init_full_exprs ../../gcc/gcc/cp/decl.c:5591 0x5c7454 check_initializer ../../gcc/gcc/cp/decl.c:5727 0x5d99fc cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int) ../../gcc/gcc/cp/decl.c:6396 0x6c81bd cp_parser_init_declarator ../../gcc/gcc/cp/parser.c:16815 0x6c9979 cp_parser_simple_declaration ../../gcc/gcc/cp/parser.c:11205 0x6acc63 cp_parser_block_declaration ../../gcc/gcc/cp/parser.c:11086 0x6d3f12 cp_parser_declaration ../../gcc/gcc/cp/parser.c:10983 0x6d2c08 cp_parser_declaration_seq_opt ../../gcc/gcc/cp/parser.c:10869 0x6d44aa cp_parser_translation_unit ../../gcc/gcc/cp/parser.c:4014 0x6d44aa c_parse_file() ../../gcc/gcc/cp/parser.c:31536 0x7f3813 c_common_parse_file() ../../gcc/gcc/c-family/c-opts.c:1060 Please submit a full bug report, [etc.] A similar testcase is wrongly accepted since GCC 4.8.1: ============================================ struct A { template void foo(T) = delete; }; template<> void A::foo(int) {} void bar() { A().foo(0); } ============================================