#include <iostream>

struct test_a{ void load(){} };
struct test_b{ };

template <template <typename> class Concept, typename Model>
    struct models
    {

        typedef char (&yes)[2];
        typedef char no;

        template <template <typename> class C, typename M, typename C<M>::type
P = 0>
            struct hint
            { };

        template <typename M>
            static yes test(M*, hint<Concept, M> * = 0);
        static no  test(...);

        static const bool value = (sizeof(test((Model*)0))==sizeof(yes));
    };

template <typename Class, typename Type>
    struct member
    {
        typedef Type Class::* type;
    };

template <typename Model>
    struct loadable
    { };


int main()
{
    std::cout << models<loadable, test_a>::value << std::endl;
}

# with 4.2.1:
$ g++-4.2 t.cc
t.cc: In instantiation of ‘models<loadable, test_a>’:
t.cc:37:   instantiated from here
t.cc:14: internal compiler error: Bus error
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for instructions.

And the same with a compiler from today as well:
$ /Volumes/pool1/mrs/packages/gcc-20080308/bin/g++ t.cc
t.cc: In instantiation of ‘models<loadable, test_a>’:
t.cc:37:   instantiated from here
t.cc:14: internal compiler error: Bus error
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

This works on comeau.

radr://5772368


-- 
           Summary: ice on valid template
           Product: gcc
           Version: 4.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mrs at apple dot com


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

Reply via email to