public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/48285] New: [C++0x] ICE in tsubst_copy_and_build
@ 2011-03-25 14:12 redi at gcc dot gnu.org
  2011-05-22 19:25 ` [Bug c++/48285] " jason at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: redi at gcc dot gnu.org @ 2011-03-25 14:12 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: [C++0x] ICE in tsubst_copy_and_build
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: redi@gcc.gnu.org


template<bool, typename T>
struct enable_if
{
    typedef T type;
};

template<typename T>
struct enable_if<false, T>
{
};

template<typename, typename>
struct is_same
{
    static const bool value = false;
};

template<typename T>
struct is_same<T,T>
{
    static const bool value = true;
};

struct S
{
    template<typename T>
        static
        auto
        f(T t) -> typename enable_if<
            is_same<decltype(t.f()), decltype(t.f())>::value,
            decltype(t.f()) >::type
        { return t.f(); }


    template<typename T>
        static
        auto
        f(T t) -> typename enable_if<
            !is_same<decltype(t.f()), decltype(t.f())>::value,
            decltype(f(t)) >::type
        { return f(t); }

};

struct X {
    int f();
};


int main()
{
    X v;

    auto i = S::f(v);
}

ICEs with any of 4.4/4.5/4.6, didn't try 4.7


Program received signal SIGSEGV, Segmentation fault.
0x00000000004b8f74 in tsubst_copy_and_build (t=0x2aaaaaae3a18,
    args=0x2aaaab753aa0, complain=0, in_decl=0x0, function_p=0 '\000',
    integral_constant_expression_p=0 '\000')
    at ../../gcc-4.6.0-RC-20110321/gcc/cp/pt.c:13293
13293           tree r = tsubst_copy (t, args, complain, in_decl);


Seems to be an infinite recursion, possibly because the second overload of S::f
tries to instantiate itself recursively - the code is probably invalid


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

* [Bug c++/48285] [C++0x] ICE in tsubst_copy_and_build
  2011-03-25 14:12 [Bug c++/48285] New: [C++0x] ICE in tsubst_copy_and_build redi at gcc dot gnu.org
@ 2011-05-22 19:25 ` jason at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: jason at gcc dot gnu.org @ 2011-05-22 19:25 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |jason at gcc dot gnu.org
         Resolution|                            |DUPLICATE

--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> 2011-05-22 19:04:01 UTC ---
Same issue as 48969.

*** This bug has been marked as a duplicate of bug 48969 ***


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

end of thread, other threads:[~2011-05-22 19:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-25 14:12 [Bug c++/48285] New: [C++0x] ICE in tsubst_copy_and_build redi at gcc dot gnu.org
2011-05-22 19:25 ` [Bug c++/48285] " 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).