1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -Wunused-value %s
3 void f() __attribute__((const));
6 // Unevaluated contexts should not trigger unused result warnings.
8 auto foo(T
) -> decltype(f(), bool()) { // Should not warn.
18 (void)noexcept(++i
); // expected-warning {{expression with side effects has no effect in an unevaluated context}}
19 decltype(i
++) j
= 0; // expected-warning {{expression with side effects has no effect in an unevaluated context}}
34 (void)noexcept(s
++); // Ok
35 (void)noexcept(i
++); // expected-warning {{expression with side effects has no effect in an unevaluated context}}
36 (void)noexcept(i
= 5); // expected-warning {{expression with side effects has no effect in an unevaluated context}}
37 (void)noexcept(s
= 5); // Ok
39 (void)sizeof(s
.f()); // Ok
40 (void)sizeof(s
.f() = 5); // expected-warning {{expression with side effects has no effect in an unevaluated context}}
41 (void)noexcept(s
.g() = 5); // Ok
46 namespace volatile_array
{
50 a
; // expected-warning-re {{expression result unused{{$}}}}
51 b
; // expected-warning-re {{expression result unused{{$}}}}