// PR c++/84231 - overload resolution with cond_expr in a template // { dg-do compile } struct format { template format& operator%(const T&) { return *this; } template format& operator%(T&) { return *this; } }; format f; template void function_template(bool b) { // Compiles OK with array lvalue: f % (b ? "x" : "x"); // Used to fails with pointer rvalue: f % (b ? "" : "x"); } void normal_function(bool b) { // Both cases compile OK in non-template function: f % (b ? "x" : "x"); f % (b ? "" : "x"); function_template(b); }