================
@@ -46,3 +46,14 @@ template <class T> void f();
template <> void f<int>(int = []{ ; return 0; }()) {} // expected-error{{no
function template matches function template specialization 'f'}} \
//
expected-note@-1{{candidate template ignored}}
}
+
+//PR208868
+struct Y {};
+enum E { e1, e2 };
+
+template<typename T>
+auto foo(E = ({ ; }) ? 0 : 1, E = e2) { // expected-error {{default argument
may not use a GNU statement expression}}
+ return 42;
+}
+
+static_assert(foo<Y>(e1) == 42, ""); // expected-error {{no matching function
for call to 'foo'}}
----------------
cor3ntin wrote:
```suggestion
namespace GH208868 {
struct Y {};
enum E { e1, e2 };
template<typename T>
auto foo(E = ({ ; }) ? 0 : 1, E = e2) { // expected-error {{default argument
may not use a GNU statement expression}}
return 42;
}
static_assert(foo<Y>(e1) == 42, ""); // expected-error {{no matching function
for call to 'foo'}}
}
```
https://github.com/llvm/llvm-project/pull/208868
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits