public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58582] New: [c++11] ICE defining and instantiating deleted template function
@ 2013-09-30 20:02 reichelt at gcc dot gnu.org
  2014-04-29 17:24 ` [Bug c++/58582] " paolo.carlini at oracle dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: reichelt at gcc dot gnu.org @ 2013-09-30 20:02 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58582

            Bug ID: 58582
           Summary: [c++11] ICE defining and instantiating deleted
                    template function
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          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++0x") triggers an ICE
since GCC 4.4.0 (when deleted functions were introduced):

========================================
struct A
{
  template<int> void foo() = delete;
};

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

template void A::foo<0>();
========================================

bug.cc:6:20: error: redefinition of 'void A::foo()'
 template<int> void A::foo() { int i; }
                    ^
bug.cc:3:22: note: 'void A::foo()' previously declared here
   template<int> void foo() = delete;
                      ^
bug.cc: In instantiation of 'void A::foo() [with int <anonymous> = 0]':
bug.cc:8:25:   required from here
bug.cc:6:36: internal compiler error: in add_stmt, at cp/semantics.c:386
 template<int> void A::foo() { int i; }
                                    ^
0x6ae530 add_stmt(tree_node*)
        ../../gcc/gcc/cp/semantics.c:386
0x5a43ac tsubst_expr
        ../../gcc/gcc/cp/pt.c:13289
0x5a1cdf instantiate_decl(tree_node*, int, bool)
        ../../gcc/gcc/cp/pt.c:19391
0x5de5ff instantiate_pending_templates(int)
        ../../gcc/gcc/cp/pt.c:19492
0x619766 cp_write_global_declarations()
        ../../gcc/gcc/cp/decl2.c:4060
Please submit a full bug report, [etc.]


A slightly modified example (just leave out "int i;") crashes in a different
place:

========================================
struct A
{
  template<int> void foo() = delete;
};

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

template void A::foo<0>();
========================================

bug.cc:6:20: error: redefinition of 'void A::foo()'
 template<int> void A::foo() {}
                    ^
bug.cc:3:22: note: 'void A::foo()' previously declared here
   template<int> void foo() = delete;
                      ^
bug.cc: In instantiation of 'void A::foo() [with int <anonymous> = 0]':
bug.cc:8:25:   required from here
bug.cc:6:30: internal compiler error: in finish_function, at cp/decl.c:13810
 template<int> void A::foo() {}
                              ^
0x56ab15 finish_function(int)
        ../../gcc/gcc/cp/decl.c:13810
0x5a1d18 instantiate_decl(tree_node*, int, bool)
        ../../gcc/gcc/cp/pt.c:19402
0x5de5ff instantiate_pending_templates(int)
        ../../gcc/gcc/cp/pt.c:19492
0x619766 cp_write_global_declarations()
        ../../gcc/gcc/cp/decl2.c:4060
Please submit a full bug report, [etc.]


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

* [Bug c++/58582] [c++11] ICE defining and instantiating deleted template function
  2013-09-30 20:02 [Bug c++/58582] New: [c++11] ICE defining and instantiating deleted template function reichelt at gcc dot gnu.org
@ 2014-04-29 17:24 ` paolo.carlini at oracle dot com
  2014-05-03 22:45 ` paolo at gcc dot gnu.org
  2014-05-03 22:46 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-04-29 17:24 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58582

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2014-04-29
           Assignee|unassigned at gcc dot gnu.org      |paolo.carlini at oracle dot com
   Target Milestone|---                         |4.10.0
     Ever confirmed|0                           |1

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Mine.


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

* [Bug c++/58582] [c++11] ICE defining and instantiating deleted template function
  2013-09-30 20:02 [Bug c++/58582] New: [c++11] ICE defining and instantiating deleted template function reichelt at gcc dot gnu.org
  2014-04-29 17:24 ` [Bug c++/58582] " paolo.carlini at oracle dot com
@ 2014-05-03 22:45 ` paolo at gcc dot gnu.org
  2014-05-03 22:46 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: paolo at gcc dot gnu.org @ 2014-05-03 22:45 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58582

--- Comment #2 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Sat May  3 22:44:22 2014
New Revision: 210043

URL: http://gcc.gnu.org/viewcvs?rev=210043&root=gcc&view=rev
Log:
/cp
2014-05-03  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/58582
    * decl.c (grokfndecl): Check duplicate_decls return value for
    error_mark_node.
    * pt.c (instantiate_decl): A deleted function is defined.

/testsuite
2014-05-03  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/58582
    * g++.dg/cpp0x/deleted4.C: New.
    * g++.dg/cpp0x/deleted5.C: Likewise.
    * g++.dg/cpp0x/deleted6.C: Likewise.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/deleted4.C
    trunk/gcc/testsuite/g++.dg/cpp0x/deleted5.C
    trunk/gcc/testsuite/g++.dg/cpp0x/deleted6.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/58582] [c++11] ICE defining and instantiating deleted template function
  2013-09-30 20:02 [Bug c++/58582] New: [c++11] ICE defining and instantiating deleted template function reichelt at gcc dot gnu.org
  2014-04-29 17:24 ` [Bug c++/58582] " paolo.carlini at oracle dot com
  2014-05-03 22:45 ` paolo at gcc dot gnu.org
@ 2014-05-03 22:46 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-05-03 22:46 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58582

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
           Assignee|paolo.carlini at oracle dot com    |unassigned at gcc dot gnu.org

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Fixed for 4.10.0.


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

end of thread, other threads:[~2014-05-03 22:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-30 20:02 [Bug c++/58582] New: [c++11] ICE defining and instantiating deleted template function reichelt at gcc dot gnu.org
2014-04-29 17:24 ` [Bug c++/58582] " paolo.carlini at oracle dot com
2014-05-03 22:45 ` paolo at gcc dot gnu.org
2014-05-03 22:46 ` paolo.carlini at oracle dot com

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).