public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/43382]  New: Internal error on C++0x code
@ 2010-03-15 20:14 chris at bubblescope dot net
  2010-03-15 23:56 ` [Bug c++/43382] ICE " paolo dot carlini at oracle dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: chris at bubblescope dot net @ 2010-03-15 20:14 UTC (permalink / raw)
  To: gcc-bugs

The following code causes an assert on a recent svn g++, with -std=c++0x. On
g++ 4.4 it produces an error. I believe the code to be valid, but am not 100%
positive.

#include <vector>

struct Range
{
        int lb;
        int ub;
        Range(int i, int j) : lb(i), ub(j) {}
        Range(const Range& r) = default;
        Range() = default;
};

template<class T>
T deref(const T& t)
{ return t; }

template <class T, template <typename T, typename...> class Cont,
          class... Args>
auto
deref(const Cont<T>& u, int i, Args... args)
-> decltype(deref(u[i], args...))
{ deref(u[i], args...); }

template <class T, template <typename T, typename...> class Cont,
          class... Args>
auto
deref(const Cont<T>& u, Range r, Args... args)
-> Cont<decltype(deref(u[0], args...))>
{
        typedef decltype(deref(u[0], args...)) member;
        Cont<member> retval;
        for(int i = r.lb; i <= r.ub; ++i)
        {
                retval.push_back(deref(u[i], args...));
        } 
        return retval;
}



int main(void)
{
        std::vector<std::vector<std::vector<int>>> v;
        int i = deref(v, 1,2,3);
        std::vector<int> j = deref(v, 1, Range(1,2), 3);
}


-- 
           Summary: Internal error on C++0x code
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: chris at bubblescope dot net


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


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

* [Bug c++/43382] ICE on C++0x code
  2010-03-15 20:14 [Bug c++/43382] New: Internal error on C++0x code chris at bubblescope dot net
@ 2010-03-15 23:56 ` paolo dot carlini at oracle dot com
  2010-03-16  8:39 ` chris at bubblescope dot net
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-03-15 23:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from paolo dot carlini at oracle dot com  2010-03-15 23:56 -------
If you could reduce it somewhat, it would be appreciated.

Let's add Jason in CC.


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu dot org
            Summary|Internal error on C++0x code|ICE on C++0x code


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


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

* [Bug c++/43382] ICE on C++0x code
  2010-03-15 20:14 [Bug c++/43382] New: Internal error on C++0x code chris at bubblescope dot net
  2010-03-15 23:56 ` [Bug c++/43382] ICE " paolo dot carlini at oracle dot com
@ 2010-03-16  8:39 ` chris at bubblescope dot net
  2010-03-16 10:28 ` paolo dot carlini at oracle dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: chris at bubblescope dot net @ 2010-03-16  8:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from chris at bubblescope dot net  2010-03-16 08:38 -------
Reduced testcase:

template<class T>
struct Container
{ T f() const; };

template<class T>
T deref(const T& t)
{ return t; }


template <class T, class... Args>
auto
deref(const T& u, int r, Args... args)
-> decltype(deref(u.f(), args...))
{ return deref(u.f(), args...); }

int main(void)
{
    Container<Container<int>> v;
    deref(v,1,2);
}


-- 


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


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

* [Bug c++/43382] ICE on C++0x code
  2010-03-15 20:14 [Bug c++/43382] New: Internal error on C++0x code chris at bubblescope dot net
  2010-03-15 23:56 ` [Bug c++/43382] ICE " paolo dot carlini at oracle dot com
  2010-03-16  8:39 ` chris at bubblescope dot net
@ 2010-03-16 10:28 ` paolo dot carlini at oracle dot com
  2010-03-16 11:51 ` rguenth at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-03-16 10:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from paolo dot carlini at oracle dot com  2010-03-16 10:27 -------
Thanks Chris.


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-03-16 10:27:59
               date|                            |


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


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

* [Bug c++/43382] ICE on C++0x code
  2010-03-15 20:14 [Bug c++/43382] New: Internal error on C++0x code chris at bubblescope dot net
                   ` (2 preceding siblings ...)
  2010-03-16 10:28 ` paolo dot carlini at oracle dot com
@ 2010-03-16 11:51 ` rguenth at gcc dot gnu dot org
  2010-05-26  4:59 ` [Bug c++/43382] [C++0x] ICE with auto return type and variadic templates jason at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-03-16 11:51 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 411 bytes --]



------- Comment #4 from rguenth at gcc dot gnu dot org  2010-03-16 11:51 -------
4.4 ICEs for me:

> g++-4.4 -S t.C -std=c++0x
t.C: In function ‘int main()’:
t.C:12: internal compiler error: in tsubst_copy, at cp/pt.c:10077
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugs.opensuse.org/> for instructions.


-- 


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


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

* [Bug c++/43382] [C++0x] ICE with auto return type and variadic templates
  2010-03-15 20:14 [Bug c++/43382] New: Internal error on C++0x code chris at bubblescope dot net
                   ` (3 preceding siblings ...)
  2010-03-16 11:51 ` rguenth at gcc dot gnu dot org
@ 2010-05-26  4:59 ` jason at gcc dot gnu dot org
  2010-05-26 15:00 ` jason at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu dot org @ 2010-05-26  4:59 UTC (permalink / raw)
  To: gcc-bugs



-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jason at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2010-03-16 10:27:59         |2010-05-26 04:59:29
               date|                            |


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


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

* [Bug c++/43382] [C++0x] ICE with auto return type and variadic templates
  2010-03-15 20:14 [Bug c++/43382] New: Internal error on C++0x code chris at bubblescope dot net
                   ` (4 preceding siblings ...)
  2010-05-26  4:59 ` [Bug c++/43382] [C++0x] ICE with auto return type and variadic templates jason at gcc dot gnu dot org
@ 2010-05-26 15:00 ` jason at gcc dot gnu dot org
  2010-05-26 15:19 ` jason at gcc dot gnu dot org
  2010-05-26 17:15 ` jason at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu dot org @ 2010-05-26 15:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jason at gcc dot gnu dot org  2010-05-26 15:00 -------
Subject: Bug 43382

Author: jason
Date: Wed May 26 15:00:02 2010
New Revision: 159873

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=159873
Log:
        PR c++/43382
        * pt.c (fn_type_unification): Don't get confused by recursive
        unification.

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


-- 


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


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

* [Bug c++/43382] [C++0x] ICE with auto return type and variadic templates
  2010-03-15 20:14 [Bug c++/43382] New: Internal error on C++0x code chris at bubblescope dot net
                   ` (5 preceding siblings ...)
  2010-05-26 15:00 ` jason at gcc dot gnu dot org
@ 2010-05-26 15:19 ` jason at gcc dot gnu dot org
  2010-05-26 17:15 ` jason at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu dot org @ 2010-05-26 15:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jason at gcc dot gnu dot org  2010-05-26 15:19 -------
Subject: Bug 43382

Author: jason
Date: Wed May 26 15:18:46 2010
New Revision: 159875

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=159875
Log:
        PR c++/43382
        * pt.c (fn_type_unification): Don't get confused by recursive
        unification.

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


-- 


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


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

* [Bug c++/43382] [C++0x] ICE with auto return type and variadic templates
  2010-03-15 20:14 [Bug c++/43382] New: Internal error on C++0x code chris at bubblescope dot net
                   ` (6 preceding siblings ...)
  2010-05-26 15:19 ` jason at gcc dot gnu dot org
@ 2010-05-26 17:15 ` jason at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu dot org @ 2010-05-26 17:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jason at gcc dot gnu dot org  2010-05-26 17:15 -------
Fixed for 4.5.1.


-- 

jason at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2010-05-26 17:15 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-15 20:14 [Bug c++/43382] New: Internal error on C++0x code chris at bubblescope dot net
2010-03-15 23:56 ` [Bug c++/43382] ICE " paolo dot carlini at oracle dot com
2010-03-16  8:39 ` chris at bubblescope dot net
2010-03-16 10:28 ` paolo dot carlini at oracle dot com
2010-03-16 11:51 ` rguenth at gcc dot gnu dot org
2010-05-26  4:59 ` [Bug c++/43382] [C++0x] ICE with auto return type and variadic templates jason at gcc dot gnu dot org
2010-05-26 15:00 ` jason at gcc dot gnu dot org
2010-05-26 15:19 ` jason at gcc dot gnu dot org
2010-05-26 17:15 ` jason at gcc dot gnu dot 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).