public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/50870] New: [C++0x] ICE with decltype, operator->, and default template arguments
@ 2011-10-25 19:16 daniel.kruegler at googlemail dot com
  2011-10-26 18:06 ` [Bug c++/50870] " paolo.carlini at oracle dot com
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2011-10-25 19:16 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 50870
           Summary: [C++0x] ICE with decltype, operator->, and default
                    template arguments
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: daniel.kruegler@googlemail.com
                CC: jason@redhat.com


This is a follow-up of bug 50864.

gcc 4.7.0 20111022 (experimental) with compiler option 

-std=c++0x -Wall

(with or without -pedantic) causes an ICE for the following code 

//---
struct impl {
  template <class T> static T create();
};

#define USE_CLASS

#ifdef USE_CLASS
template<class T, class U,
  class = decltype(impl::create<T>()->impl::create<U>()) // line 9
>
struct tester{};

tester<impl*, int> ti;
#else
template<class T, class U,
  class = decltype(impl::create<T>()->impl::create<U>()) // line 16
>
int test() { return 0; }

int i = test<impl*, int>();
#endif
//---

If USE_CLASS is defined:

"main.cpp|9|internal compiler error: Segmentation fault"

otherwise:

"main.cpp|16|internal compiler error: Segmentation fault"

Both code branches should be accepted.


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

* [Bug c++/50870] [C++0x] ICE with decltype, operator->, and default template arguments
  2011-10-25 19:16 [Bug c++/50870] New: [C++0x] ICE with decltype, operator->, and default template arguments daniel.kruegler at googlemail dot com
@ 2011-10-26 18:06 ` paolo.carlini at oracle dot com
  2011-10-26 18:07 ` paolo at gcc dot gnu.org
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-10-26 18:06 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.7.0

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-10-26 18:03:20 UTC ---
Fixed for 4.7.0.


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

* [Bug c++/50870] [C++0x] ICE with decltype, operator->, and default template arguments
  2011-10-25 19:16 [Bug c++/50870] New: [C++0x] ICE with decltype, operator->, and default template arguments daniel.kruegler at googlemail dot com
  2011-10-26 18:06 ` [Bug c++/50870] " paolo.carlini at oracle dot com
@ 2011-10-26 18:07 ` paolo at gcc dot gnu.org
  2011-10-26 22:10 ` [Bug c++/50870] [C++0x] [4.6/4.7 Regression] " paolo.carlini at oracle dot com
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: paolo at gcc dot gnu.org @ 2011-10-26 18:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> 2011-10-26 17:59:42 UTC ---
Author: paolo
Date: Wed Oct 26 17:59:36 2011
New Revision: 180531

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=180531
Log:
2011-10-26  Paolo Carlini  <paolo.carlini@oracle.com>

    * typeck.c (cp_build_addr_expr_1): Use BASELINK_P.
    * class.c (instantiate_type): Likewise.
    * pt.c (convert_nontype_argument_function, uses_template_parms,
    tsubst_copy, resolve_nondeduced_context, type_dependent_expression_p):
    Likewise.
    * semantics.c (finish_decltype_type): Likewise.
    * decl2.c (mark_used): Likewise.
    * name-lookup.c (arg_assoc): Likewise.

/cp
2011-10-26  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/50870
    * typeck.c (non_reference): Pass NULL_TREE through.

/testsuite
2011-10-26  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/50870
    * g++.dg/cpp0x/decltype34.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/decltype34.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/class.c
    trunk/gcc/cp/decl2.c
    trunk/gcc/cp/name-lookup.c
    trunk/gcc/cp/pt.c
    trunk/gcc/cp/semantics.c
    trunk/gcc/cp/typeck.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/50870] [C++0x] [4.6/4.7 Regression] ICE with decltype, operator->, and default template arguments
  2011-10-25 19:16 [Bug c++/50870] New: [C++0x] ICE with decltype, operator->, and default template arguments daniel.kruegler at googlemail dot com
  2011-10-26 18:06 ` [Bug c++/50870] " paolo.carlini at oracle dot com
  2011-10-26 18:07 ` paolo at gcc dot gnu.org
@ 2011-10-26 22:10 ` paolo.carlini at oracle dot com
  2011-10-27 11:49 ` rguenth at gcc dot gnu.org
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-10-26 22:10 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
   Last reconfirmed|                            |2011-10-26
                 CC|paolo.carlini at oracle dot |
                   |com                         |
         Resolution|FIXED                       |
         AssignedTo|unassigned at gcc dot       |paolo.carlini at oracle dot
                   |gnu.org                     |com
   Target Milestone|4.7.0                       |4.6.3
            Summary|[C++0x] ICE with decltype,  |[C++0x] [4.6/4.7
                   |operator->, and default     |Regression] ICE with
                   |template arguments          |decltype, operator->, and
                   |                            |default template arguments
     Ever Confirmed|0                           |1

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-10-26 22:10:11 UTC ---
Uhhm, let's reopen this: first it's a 4.6 Regression too, second we are still
not Ok for impl template, eg:

template <class V>
  struct impl
  {
    template <class T> static T create();
  };

template <class T, class U, class V, class
      = decltype(impl<V>::template create<T>()
             -> impl<V>::template create<U>())>
struct tester { };

tester<impl<float>*, int, float> ti;


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

* [Bug c++/50870] [C++0x] [4.6/4.7 Regression] ICE with decltype, operator->, and default template arguments
  2011-10-25 19:16 [Bug c++/50870] New: [C++0x] ICE with decltype, operator->, and default template arguments daniel.kruegler at googlemail dot com
                   ` (2 preceding siblings ...)
  2011-10-26 22:10 ` [Bug c++/50870] [C++0x] [4.6/4.7 Regression] " paolo.carlini at oracle dot com
@ 2011-10-27 11:49 ` rguenth at gcc dot gnu.org
  2011-10-28  9:52 ` paolo.carlini at oracle dot com
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-10-27 11:49 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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

* [Bug c++/50870] [C++0x] [4.6/4.7 Regression] ICE with decltype, operator->, and default template arguments
  2011-10-25 19:16 [Bug c++/50870] New: [C++0x] ICE with decltype, operator->, and default template arguments daniel.kruegler at googlemail dot com
                   ` (3 preceding siblings ...)
  2011-10-27 11:49 ` rguenth at gcc dot gnu.org
@ 2011-10-28  9:52 ` paolo.carlini at oracle dot com
  2011-10-28 15:54 ` hjl.tools at gmail dot com
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-10-28  9:52 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hjl.tools at gmail dot com

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-10-28 09:52:14 UTC ---
HJ, any chance you can figure out when we regressed for testcase in Comment #3
?


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

* [Bug c++/50870] [C++0x] [4.6/4.7 Regression] ICE with decltype, operator->, and default template arguments
  2011-10-25 19:16 [Bug c++/50870] New: [C++0x] ICE with decltype, operator->, and default template arguments daniel.kruegler at googlemail dot com
                   ` (4 preceding siblings ...)
  2011-10-28  9:52 ` paolo.carlini at oracle dot com
@ 2011-10-28 15:54 ` hjl.tools at gmail dot com
  2011-10-28 16:41 ` paolo.carlini at oracle dot com
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: hjl.tools at gmail dot com @ 2011-10-28 15:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from H.J. Lu <hjl.tools at gmail dot com> 2011-10-28 15:53:39 UTC ---
(In reply to comment #4)
> HJ, any chance you can figure out when we regressed for testcase in Comment #3
> ?

I tried different versions of GCC, I got

pr50870.cc:8: error: expected type-specifier before ‘decltype’
pr50870.cc:8: error: expected `>' before ‘decltype’
pr50870.cc:12: error: template argument 4 is invalid
pr50870.cc:12: error: invalid type in declaration before ‘;’ token


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

* [Bug c++/50870] [C++0x] [4.6/4.7 Regression] ICE with decltype, operator->, and default template arguments
  2011-10-25 19:16 [Bug c++/50870] New: [C++0x] ICE with decltype, operator->, and default template arguments daniel.kruegler at googlemail dot com
                   ` (5 preceding siblings ...)
  2011-10-28 15:54 ` hjl.tools at gmail dot com
@ 2011-10-28 16:41 ` paolo.carlini at oracle dot com
  2011-10-28 19:41 ` hjl.tools at gmail dot com
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-10-28 16:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-10-28 16:40:15 UTC ---
HJ, if you are willing to help you have to use -std=c++0x with this (see the
[C++0x] in the Description]. 4_5-branch accepts the snippet, the regression is
rather old.


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

* [Bug c++/50870] [C++0x] [4.6/4.7 Regression] ICE with decltype, operator->, and default template arguments
  2011-10-25 19:16 [Bug c++/50870] New: [C++0x] ICE with decltype, operator->, and default template arguments daniel.kruegler at googlemail dot com
                   ` (6 preceding siblings ...)
  2011-10-28 16:41 ` paolo.carlini at oracle dot com
@ 2011-10-28 19:41 ` hjl.tools at gmail dot com
  2011-10-28 23:24 ` paolo.carlini at oracle dot com
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: hjl.tools at gmail dot com @ 2011-10-28 19:41 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dodji at gcc dot gnu.org

--- Comment #7 from H.J. Lu <hjl.tools at gmail dot com> 2011-10-28 19:41:40 UTC ---
(In reply to comment #3)
> Uhhm, let's reopen this: first it's a 4.6 Regression too, second we are still
> not Ok for impl template, eg:
> 
> template <class V>
>   struct impl
>   {
>     template <class T> static T create();
>   };
> 
> template <class T, class U, class V, class
>       = decltype(impl<V>::template create<T>()
>              -> impl<V>::template create<U>())>
> struct tester { };
> 
> tester<impl<float>*, int, float> ti;

It is caused by revision 166179:

http://gcc.gnu.org/ml/gcc-cvs/2010-11/msg00065.html


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

* [Bug c++/50870] [C++0x] [4.6/4.7 Regression] ICE with decltype, operator->, and default template arguments
  2011-10-25 19:16 [Bug c++/50870] New: [C++0x] ICE with decltype, operator->, and default template arguments daniel.kruegler at googlemail dot com
                   ` (7 preceding siblings ...)
  2011-10-28 19:41 ` hjl.tools at gmail dot com
@ 2011-10-28 23:24 ` paolo.carlini at oracle dot com
  2011-11-07 22:24 ` jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-10-28 23:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-10-28 23:23:43 UTC ---
Thanks HJ.

Dodji, I tried to help a bit with these issues and made some progress, thanks
to Jason's help, of course. But this remaining issue is probably too hard to
debug for me, given my still limited understanding of the front-end. If you
could help it would be great.  Note: now that PR50864 is fixed in mainline, we
don't ICE anymore for the testcase in Comment #3, we reject it.


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

* [Bug c++/50870] [C++0x] [4.6/4.7 Regression] ICE with decltype, operator->, and default template arguments
  2011-10-25 19:16 [Bug c++/50870] New: [C++0x] ICE with decltype, operator->, and default template arguments daniel.kruegler at googlemail dot com
                   ` (8 preceding siblings ...)
  2011-10-28 23:24 ` paolo.carlini at oracle dot com
@ 2011-11-07 22:24 ` jason at gcc dot gnu.org
  2011-11-07 22:58 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2011-11-07 22:24 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |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] 14+ messages in thread

* [Bug c++/50870] [C++0x] [4.6/4.7 Regression] ICE with decltype, operator->, and default template arguments
  2011-10-25 19:16 [Bug c++/50870] New: [C++0x] ICE with decltype, operator->, and default template arguments daniel.kruegler at googlemail dot com
                   ` (9 preceding siblings ...)
  2011-11-07 22:24 ` jason at gcc dot gnu.org
@ 2011-11-07 22:58 ` jason at gcc dot gnu.org
  2011-11-08  0:48 ` jason at gcc dot gnu.org
  2011-11-08  1:36 ` jason at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2011-11-07 22:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> 2011-11-07 22:52:27 UTC ---
Author: jason
Date: Mon Nov  7 22:52:23 2011
New Revision: 181131

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181131
Log:
    PR c++/50870
    * pt.c (tsubst_copy): Handle NAMESPACE_DECL.
    (tsubst_copy_and_build) [COMPONENT_REF]: Handle a still-dependent
    object.

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


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

* [Bug c++/50870] [C++0x] [4.6/4.7 Regression] ICE with decltype, operator->, and default template arguments
  2011-10-25 19:16 [Bug c++/50870] New: [C++0x] ICE with decltype, operator->, and default template arguments daniel.kruegler at googlemail dot com
                   ` (10 preceding siblings ...)
  2011-11-07 22:58 ` jason at gcc dot gnu.org
@ 2011-11-08  0:48 ` jason at gcc dot gnu.org
  2011-11-08  1:36 ` jason at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2011-11-08  0:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Jason Merrill <jason at gcc dot gnu.org> 2011-11-08 00:46:10 UTC ---
Author: jason
Date: Tue Nov  8 00:46:06 2011
New Revision: 181140

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181140
Log:
    PR c++/50870
    * pt.c (tsubst_copy): Handle NAMESPACE_DECL.
    (tsubst_copy_and_build) [COMPONENT_REF]: Handle a still-dependent
    object.

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


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

* [Bug c++/50870] [C++0x] [4.6/4.7 Regression] ICE with decltype, operator->, and default template arguments
  2011-10-25 19:16 [Bug c++/50870] New: [C++0x] ICE with decltype, operator->, and default template arguments daniel.kruegler at googlemail dot com
                   ` (11 preceding siblings ...)
  2011-11-08  0:48 ` jason at gcc dot gnu.org
@ 2011-11-08  1:36 ` jason at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2011-11-08  1:36 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #11 from Jason Merrill <jason at gcc dot gnu.org> 2011-11-08 01:11:42 UTC ---
Fixed.


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

end of thread, other threads:[~2011-11-08  1:12 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-25 19:16 [Bug c++/50870] New: [C++0x] ICE with decltype, operator->, and default template arguments daniel.kruegler at googlemail dot com
2011-10-26 18:06 ` [Bug c++/50870] " paolo.carlini at oracle dot com
2011-10-26 18:07 ` paolo at gcc dot gnu.org
2011-10-26 22:10 ` [Bug c++/50870] [C++0x] [4.6/4.7 Regression] " paolo.carlini at oracle dot com
2011-10-27 11:49 ` rguenth at gcc dot gnu.org
2011-10-28  9:52 ` paolo.carlini at oracle dot com
2011-10-28 15:54 ` hjl.tools at gmail dot com
2011-10-28 16:41 ` paolo.carlini at oracle dot com
2011-10-28 19:41 ` hjl.tools at gmail dot com
2011-10-28 23:24 ` paolo.carlini at oracle dot com
2011-11-07 22:24 ` jason at gcc dot gnu.org
2011-11-07 22:58 ` jason at gcc dot gnu.org
2011-11-08  0:48 ` jason at gcc dot gnu.org
2011-11-08  1:36 ` 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).