Debian Codegraph @

gcc/testsuite/g++.dg/parse/missing-parens-fixit.C

raw
1 // { dg-options "-fdiagnostics-show-caret" }
2
3 class t1
4 {
5 public:
6 double length () const { return m_length; }
7 double area (double width) const { return m_length * width; }
8
9 private:
10 double m_length;
11 };
12
13 bool test_1 (const t1 &inst)
14 {
15 return inst.length > 0.0; // { dg-error "did you forget the '\\(\\)'" }
16 /* We expect a fix-it hint. */
17 /* { dg-begin-multiline-output "" }
18 return inst.length > 0.0;
19 ~~~~~^~~~~~
20 ()
21 { dg-end-multiline-output "" } */
22 }
23
24 bool test_2 (const t1 &inst)
25 {
26 return inst.area > 0.0; // { dg-error "did you forget the '\\(\\)'" }
27 /* "t1::area" has additional params, so we don't expect a fix-it hint. */
28 /* { dg-begin-multiline-output "" }
29 return inst.area > 0.0;
30 ~~~~~^~~~
31 { dg-end-multiline-output "" } */
32 }