This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/48882] ?: ternary operator fails in certain contexts - compile error
- From: "jason at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 4 Jul 2011 22:31:53 +0000
- Subject: [Bug libstdc++/48882] ?: ternary operator fails in certain contexts - compile error
- Auto-submitted: auto-generated
- References: <bug-48882-4@http.gcc.gnu.org/bugzilla/>
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.