This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/41927] New: [C++0x] Spurious warning with enable_if and efault function template argument


This issue is very annoying, triggers in many places in the C++0x library, is
not suppressed in system headers. Just compile the below with -std=c++0x and
-Wall. Jason, any chance you can have a look?

template<typename Tp>
  struct is_int
  { static const bool value = true; };  

template<bool, typename Tp = void>
  struct enable_if 
  { };

template<typename Tp>
  struct enable_if<true, Tp>
  { typedef Tp type; };

template<typename Rep>
  struct duration
  {
    duration() { }

    template<typename Rep2, typename = typename
             enable_if<false || (true && is_int<Rep2>::value)>::type>
    duration(const duration<Rep2>&) { }
  };

int main()
{
  duration<int> d0;
  duration<int> d1 = d0;
}


-- 
           Summary: [C++0x] Spurious warning with enable_if and efault
                    function template argument
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: paolo dot carlini at oracle dot com


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]