2018-11-07 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / g++.dg / torture / accessor-fixits-6.C
blobae2f180a8f2e946a4c225cc2d33fa5a3e29f9724
1 // PR c++/84994
2 /* Ensure that fix-it hints are offered at every optimization level, even when
3    "-g" is enabled (coverage for every optimization level without -g is given
4    by the other cases within g++.dg/torture/accessor-fixits-*.C).  */
5 // { dg-additional-options "-g" }
7 class foo
9 public:
10   double get_ratio() const { return m_ratio; }
12 private:
13   double m_ratio; // { dg-line field_decl }
16 void test(foo *ptr)
18   if (ptr->m_ratio >= 0.5) // { dg-error "'double foo::m_ratio' is private within this context" }
19     ;
20   // { dg-message "declared private here" "" { target *-*-* } field_decl }
21   // { dg-message "'double foo::m_ratio' can be accessed via 'double foo::get_ratio\\(\\) const'" "" { target *-*-* } .-3 }