g++ -c the attached sample fails with
/usr/include/g++/bits/stl_algo.h: In function `void
   std::__final_insertion_sort(_RandomAccessIter, _RandomAccessIter) [with
   _RandomAccessIter = __gnu_cxx::__normal_iterator<foo*, std::vector<foo,
   std::allocator<foo> > >]':
/usr/include/g++/bits/stl_algo.h:2181:   instantiated from `void
std::sort(_RandomAccessIter, _RandomAccessIter) [with _RandomAccessIter =
__gnu_cxx::__normal_iterator<foo*, std::vector<foo, std::allocator<foo> > >]'
testenum.cpp:21:   instantiated from here
/usr/include/g++/bits/stl_algo.h:2059: error: template-argument `
   std::<anonymous enum>' uses anonymous type
/usr/include/g++/bits/stl_algo.h:2181:   instantiated from `void
std::sort(_RandomAccessIter, _RandomAccessIter) [with _RandomAccessIter =
__gnu_cxx::__normal_iterator<foo*, std::vector<foo, std::allocator<foo> > >]'
testenum.cpp:21:   instantiated from here
/usr/include/g++/bits/stl_algo.h:2060: error: template-argument `
   std::<anonymous enum>' uses anonymous type

The problem: std::sort (and other components of libstdc++) use anonymmous
enumerations for private constants.  However if there is a template
operator/function in an associated namespace that uses SFINAE, it will fail
according to 14.3.1/2.

The resolution of DR-488 will surely fix this, presumably by making the
substitution fail (without error), but irrespective of this DR, I cannot find
anything in the standard that suggests that the attached code is
non-conforming.


-- 
           Summary: Libstdc++ uses anonymous enums, causing failures due to
                    DR488
           Product: gcc
           Version: 3.3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ianmcc at physik dot rwth-aachen dot de


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

Reply via email to