build: Fix missing variable quotes
[official-gcc.git] / gcc / testsuite / g++.dg / pr84231.C
blobde7c89a2ab6950a7e7860607a8f779f766be2265
1 // PR c++/84231 - overload resolution with cond_expr in a template
3 // { dg-do compile }
5 struct format {
6   template<typename T> format& operator%(const T&) { return *this; }
7   template<typename T> format& operator%(T&) { return *this; }
8 };
10 format f;
12 template <typename>
13 void function_template(bool b)
15   // Compiles OK with array lvalue:
16   f % (b ? "x" : "x");
18   // Used to fails with pointer rvalue:
19   f % (b ? "" : "x");
22 void normal_function(bool b)
24   // Both cases compile OK in non-template function:
25   f % (b ? "x" : "x");
26   f % (b ? "" : "x");
28   function_template<void>(b);