I believe the program below is well-formed (the latest EDG eccp 3.7 concurs),
but gcc 4.1.0 rejects it.

$ cat t.cpp && gcc --version && gcc t.cpp
template <int> struct A { typedef int I; };

struct X { };
template <class T> struct B { typedef typename T::J J; };
template <class T> struct B<T*> { typedef X J; };

template <class T>
typename A<T () | T ()>::I foo (T) { return 0; }

template <class T> typename B<T>::J foo (T) { return typename B<T>::J ();
}

int main ()
{
    foo ("");
}

gcc (GCC) 4.1.0
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

t.cpp: In function 'int main()':
t.cpp:15: error: invalid operands of types 'const char*' and 'const char*' to
binary 'operator|'


-- 
           Summary: error on SFINAE
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sebor at roguewave dot com
 GCC build triplet: sparc-sun-solaris2.9
  GCC host triplet: sparc-sun-solaris2.9
GCC target triplet: sparc-sun-solaris2.9


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

Reply via email to