1 // { dg-options "-fdiagnostics-show-caret" }
6 int& get_color () { return m_color; }
7 int& get_shape () { return m_shape; }
10 int m_color; // { dg-line color_decl }
11 int m_shape; // { dg-line shape_decl }
14 int test_const_ptr (const t1 *ptr)
16 return ptr->m_color; // { dg-error ".int t1::m_color. is private within this context" }
17 /* { dg-begin-multiline-output "" }
20 { dg-end-multiline-output "" } */
22 // { dg-message "declared private here" "" { target *-*-* } color_decl }
23 /* { dg-begin-multiline-output "" }
26 { dg-end-multiline-output "" } */
28 /* We shouldn't issue a suggestion: the accessor is non-const, and we
29 only have a const ptr. */
32 int test_const_reference (const t1 &ref)
34 return ref.m_shape; // { dg-error ".int t1::m_shape. is private within this context" }
35 /* { dg-begin-multiline-output "" }
38 { dg-end-multiline-output "" } */
40 // { dg-message "declared private here" "" { target *-*-* } shape_decl }
41 /* { dg-begin-multiline-output "" }
44 { dg-end-multiline-output "" } */
46 /* We shouldn't issue a suggestion: the accessor is non-const, and we
47 only have a const ptr. */