public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/49921] New: Segfault during compilation, decltype and operator->*
@ 2011-07-31 10:03 fabian.bergmark at gmail dot com
  2011-07-31 10:26 ` [Bug c++/49921] " fabian.bergmark at gmail dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: fabian.bergmark at gmail dot com @ 2011-07-31 10:03 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: Segfault during compilation, decltype and operator->*
           Product: gcc
           Version: 4.5.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: fabian.bergmark@gmail.com


Code:

#include <iostream>

class Local
{
    public:
        void func() {};
};

int main()
{
    Local* l = new Local;
    void(Local::*ptr)();
    ptr = &Local::func;
    decltype((l->*ptr)) i;
    std::cerr << typeid(i).name << std::endl;
}

Output:

gcc test.cpp -o test -std=c++0x
test.cpp: In function ‘int main()’:
test.cpp:15:22: internal compiler error: Segmenteringsfel
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.5/README.Bugs> for instructions.


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

* [Bug c++/49921] Segfault during compilation, decltype and operator->*
  2011-07-31 10:03 [Bug c++/49921] New: Segfault during compilation, decltype and operator->* fabian.bergmark at gmail dot com
@ 2011-07-31 10:26 ` fabian.bergmark at gmail dot com
  2011-07-31 10:38 ` [Bug c++/49921] [C++0x] " paolo.carlini at oracle dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: fabian.bergmark at gmail dot com @ 2011-07-31 10:26 UTC (permalink / raw)
  To: gcc-bugs

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

fabian.bergmark at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |blocker


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

* [Bug c++/49921] [C++0x] Segfault during compilation, decltype and operator->*
  2011-07-31 10:03 [Bug c++/49921] New: Segfault during compilation, decltype and operator->* fabian.bergmark at gmail dot com
  2011-07-31 10:26 ` [Bug c++/49921] " fabian.bergmark at gmail dot com
@ 2011-07-31 10:38 ` paolo.carlini at oracle dot com
  2011-07-31 10:57 ` fabian.bergmark at gmail dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-07-31 10:38 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.07.31 10:38:25
            Summary|Segfault during             |[C++0x] Segfault during
                   |compilation, decltype and   |compilation, decltype and
                   |operator->*                 |operator->*
     Ever Confirmed|0                           |1
           Severity|blocker                     |normal

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-07-31 10:38:25 UTC ---
Confirmed. Mainline says:

49921.C: In function ‘int main()’:
49921.C:15:25: internal compiler error: tree check: expected record_type or
union_type or qual_union_type, have translation_unit_decl in
maybe_dummy_object, at cp/tree.c:2474


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

* [Bug c++/49921] [C++0x] Segfault during compilation, decltype and operator->*
  2011-07-31 10:03 [Bug c++/49921] New: Segfault during compilation, decltype and operator->* fabian.bergmark at gmail dot com
  2011-07-31 10:26 ` [Bug c++/49921] " fabian.bergmark at gmail dot com
  2011-07-31 10:38 ` [Bug c++/49921] [C++0x] " paolo.carlini at oracle dot com
@ 2011-07-31 10:57 ` fabian.bergmark at gmail dot com
  2011-08-01  9:52 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: fabian.bergmark at gmail dot com @ 2011-07-31 10:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from fabian.bergmark at gmail dot com 2011-07-31 10:57:17 UTC ---
(In reply to comment #1)
> Confirmed. Mainline says:
> 
> 49921.C: In function ‘int main()’:
> 49921.C:15:25: internal compiler error: tree check: expected record_type or
> union_type or qual_union_type, have translation_unit_decl in
> maybe_dummy_object, at cp/tree.c:2474

To quote Modern C++ Design by Andrei Alexandrescu:

"In C++, where every object has a type, the result of operator->* or operator.*
is a unique exception."

and

"Both are binary functions all right, and they return something to which you
can apply the function-call operator immediately, but that "something" does no
have a type."

Is this possibly the reason to the error?


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

* [Bug c++/49921] [C++0x] Segfault during compilation, decltype and operator->*
  2011-07-31 10:03 [Bug c++/49921] New: Segfault during compilation, decltype and operator->* fabian.bergmark at gmail dot com
                   ` (2 preceding siblings ...)
  2011-07-31 10:57 ` fabian.bergmark at gmail dot com
@ 2011-08-01  9:52 ` redi at gcc dot gnu.org
  2011-08-05 21:40 ` jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2011-08-01  9:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-08-01 09:51:56 UTC ---
Yes, the standard says:

"If the result of .* or ->* is a function, then that result can be used only as
the operand for the function call operator ()"

So I think G++ should reject decltype((l->*ptr))


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

* [Bug c++/49921] [C++0x] Segfault during compilation, decltype and operator->*
  2011-07-31 10:03 [Bug c++/49921] New: Segfault during compilation, decltype and operator->* fabian.bergmark at gmail dot com
                   ` (3 preceding siblings ...)
  2011-08-01  9:52 ` redi at gcc dot gnu.org
@ 2011-08-05 21:40 ` jason at gcc dot gnu.org
  2011-08-06  4:37 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2011-08-05 21:40 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |jason at gcc dot gnu.org
         AssignedTo|unassigned at gcc dot       |jason at gcc dot gnu.org
                   |gnu.org                     |


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

* [Bug c++/49921] [C++0x] Segfault during compilation, decltype and operator->*
  2011-07-31 10:03 [Bug c++/49921] New: Segfault during compilation, decltype and operator->* fabian.bergmark at gmail dot com
                   ` (4 preceding siblings ...)
  2011-08-05 21:40 ` jason at gcc dot gnu.org
@ 2011-08-06  4:37 ` jason at gcc dot gnu.org
  2011-08-06  4:38 ` jason at gcc dot gnu.org
  2011-08-06 22:23 ` jason at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2011-08-06  4:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> 2011-08-06 04:34:40 UTC ---
Author: jason
Date: Sat Aug  6 04:34:37 2011
New Revision: 177498

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=177498
Log:
    PR c++/49921
    * semantics.c (finish_decltype_type): Call invalid_nonstatic_memfn_p.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/decltype31.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/semantics.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/49921] [C++0x] Segfault during compilation, decltype and operator->*
  2011-07-31 10:03 [Bug c++/49921] New: Segfault during compilation, decltype and operator->* fabian.bergmark at gmail dot com
                   ` (5 preceding siblings ...)
  2011-08-06  4:37 ` jason at gcc dot gnu.org
@ 2011-08-06  4:38 ` jason at gcc dot gnu.org
  2011-08-06 22:23 ` jason at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2011-08-06  4:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> 2011-08-06 04:38:27 UTC ---
Author: jason
Date: Sat Aug  6 04:38:24 2011
New Revision: 177502

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=177502
Log:
    PR c++/49921
    * semantics.c (finish_decltype_type): Call invalid_nonstatic_memfn_p.

Added:
    branches/gcc-4_6-branch/gcc/testsuite/g++.dg/cpp0x/decltype31.C
Modified:
    branches/gcc-4_6-branch/gcc/cp/ChangeLog
    branches/gcc-4_6-branch/gcc/cp/semantics.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog


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

* [Bug c++/49921] [C++0x] Segfault during compilation, decltype and operator->*
  2011-07-31 10:03 [Bug c++/49921] New: Segfault during compilation, decltype and operator->* fabian.bergmark at gmail dot com
                   ` (6 preceding siblings ...)
  2011-08-06  4:38 ` jason at gcc dot gnu.org
@ 2011-08-06 22:23 ` jason at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2011-08-06 22:23 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.6.2

--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> 2011-08-06 22:23:19 UTC ---
Fixed for 4.6.2.


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

end of thread, other threads:[~2011-08-06 22:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-31 10:03 [Bug c++/49921] New: Segfault during compilation, decltype and operator->* fabian.bergmark at gmail dot com
2011-07-31 10:26 ` [Bug c++/49921] " fabian.bergmark at gmail dot com
2011-07-31 10:38 ` [Bug c++/49921] [C++0x] " paolo.carlini at oracle dot com
2011-07-31 10:57 ` fabian.bergmark at gmail dot com
2011-08-01  9:52 ` redi at gcc dot gnu.org
2011-08-05 21:40 ` jason at gcc dot gnu.org
2011-08-06  4:37 ` jason at gcc dot gnu.org
2011-08-06  4:38 ` jason at gcc dot gnu.org
2011-08-06 22:23 ` 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).