public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60216] New: [4.8/4.9 Regression] [c++11] Trouble with deleted template functions
@ 2014-02-15 21:10 reichelt at gcc dot gnu.org
  2014-02-15 21:11 ` [Bug c++/60216] " reichelt at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: reichelt at gcc dot gnu.org @ 2014-02-15 21:10 UTC (permalink / raw)
  To: gcc-bugs

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<typename T> A(T) = delete;
};

template<> A::A<int>(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*, va_gc,
vl_embed>**, tree_node*, int, tree_node**, int)
        ../../gcc/gcc/cp/call.c:7957
0x5b4d79 build_special_member_call(tree_node*, tree_node*, vec<tree_node*,
va_gc, vl_embed>**, 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<typename T> void foo(T) = delete;
};

template<> void A::foo<int>(int) {}

void bar()
{
  A().foo(0);
}
============================================


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-02-21 15:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-15 21:10 [Bug c++/60216] New: [4.8/4.9 Regression] [c++11] Trouble with deleted template functions reichelt at gcc dot gnu.org
2014-02-15 21:11 ` [Bug c++/60216] " reichelt at gcc dot gnu.org
2014-02-16 19:35 ` reichelt at gcc dot gnu.org
2014-02-17 10:10 ` jakub at gcc dot gnu.org
2014-02-17 12:26 ` rguenth at gcc dot gnu.org
2014-02-21  6:10 ` jason at gcc dot gnu.org
2014-02-21 13:33 ` jason at gcc dot gnu.org
2014-02-21 14:57 ` jason at gcc dot gnu.org
2014-02-21 15:30 ` jason at gcc dot gnu.org
2014-02-21 15:39 ` jason at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).