blob: de7c89a2ab6950a7e7860607a8f779f766be2265 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
// PR c++/84231 - overload resolution with cond_expr in a template
// { dg-do compile }
struct format {
template<typename T> format& operator%(const T&) { return *this; }
template<typename T> format& operator%(T&) { return *this; }
};
format f;
template <typename>
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<void>(b);
}
|