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 libstdc++/48882] ?: ternary operator fails in certain contexts - compile error


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org
          Component|c++                         |libstdc++

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2011-07-04 22:30:42 UTC ---
In C++0x max<int> no longer designates a single template specialization, as now
there are initializer_list overloads as well:

template<class T> const T& max(const T& a, const T& b);
template<class T> T max(initializer_list<T> t);

And likewise for min.  So the type of the ?: expression is unknown.  When you
rewrite it as if/else you provide a type to resolve to, so it works.

This is not a compiler bug.  Leaving as unconfirmed and changing category to
libstdc++ in case the library folks think this is an issue worth raising with
the committee.


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