1 // PR c++/97518
2 // { dg-do compile { target c++11 } }
3 // { dg-options "-fdiagnostics-show-caret" }
4 
yes()5 constexpr bool yes () { return true; }
no()6 constexpr bool no () { return false; }
7 constexpr bool yay = true;
8 constexpr bool nay = false;
9 
10 void
bar()11 bar ()
12 {
13   static_assert (true && true && no(), ""); // { dg-error "static assertion failed" }
14 /* { dg-begin-multiline-output "" }
15    static_assert (true && true && no(), "");
16                                   ~~^~
17    { dg-end-multiline-output "" } */
18   static_assert (yay && nay, ""); // { dg-error "static assertion failed" }
19 /* { dg-begin-multiline-output "" }
20    static_assert (yay && nay, "");
21                          ^~~
22    { dg-end-multiline-output "" } */
23   static_assert (yes() && no(), ""); // { dg-error "static assertion failed" }
24 /* { dg-begin-multiline-output "" }
25    static_assert (yes() && no(), "");
26                            ~~^~
27    { dg-end-multiline-output "" } */
28   static_assert (no() && yes(), ""); // { dg-error "static assertion failed" }
29 /* { dg-begin-multiline-output "" }
30    static_assert (no() && yes(), "");
31                   ~~^~
32    { dg-end-multiline-output "" } */
33   static_assert (no() && no() && yes(), ""); // { dg-error "static assertion failed" }
34 /* { dg-begin-multiline-output "" }
35    static_assert (no() && no() && yes(), "");
36                   ~~^~
37    { dg-end-multiline-output "" } */
38   static_assert (yes() && yes() && yes () && no() && yes(), ""); // { dg-error "static assertion failed" }
39 /* { dg-begin-multiline-output "" }
40    static_assert (yes() && yes() && yes () && no() && yes(), "");
41                                               ~~^~
42    { dg-end-multiline-output "" } */
43   static_assert (yes() && yes() && yes () && (no() && yes()), ""); // { dg-error "static assertion failed" }
44 /* { dg-begin-multiline-output "" }
45    static_assert (yes() && yes() && yes () && (no() && yes()), "");
46                                                ~~^~
47    { dg-end-multiline-output "" } */
48   static_assert ((yes() && no()) && no(), ""); // { dg-error "static assertion failed" }
49 /* { dg-begin-multiline-output "" }
50    static_assert ((yes() && no()) && no(), "");
51                             ~~^~
52    { dg-end-multiline-output "" } */
53   static_assert ((yes() && no()) && no(), ""); // { dg-error "static assertion failed" }
54 /* { dg-begin-multiline-output "" }
55    static_assert ((yes() && no()) && no(), "");
56                             ~~^~
57    { dg-end-multiline-output "" } */
58   static_assert ((no() || no()) && yes(), ""); // { dg-error "static assertion failed" }
59 /* { dg-begin-multiline-output "" }
60    static_assert ((no() || no()) && yes(), "");
61                   ~~~~~~^~~~~~~~
62    { dg-end-multiline-output "" } */
63   static_assert ((yes() || no()) && no(), ""); // { dg-error "static assertion failed" }
64 /* { dg-begin-multiline-output "" }
65    static_assert ((yes() || no()) && no(), "");
66                                      ~~^~
67    { dg-end-multiline-output "" } */
68 }
69