From 674e06f77ebfb7d8fc867c27b5281be691d86970 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Tue, 1 Dec 2015 10:44:37 -0500 Subject: [PATCH 12/26] FIXME: add test coverage for method calls --- .../g++.dg/plugin/diagnostic-test-expressions-1.C | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/gcc/testsuite/g++.dg/plugin/diagnostic-test-expressions-1.C b/gcc/testsuite/g++.dg/plugin/diagnostic-test-expressions-1.C index ec76b62..264beb7 100644 --- a/gcc/testsuite/g++.dg/plugin/diagnostic-test-expressions-1.C +++ b/gcc/testsuite/g++.dg/plugin/diagnostic-test-expressions-1.C @@ -502,6 +502,9 @@ class base { base (); base (int i); virtual ~base (); + int pub (); +private: + int priv (); }; class derived : public base { ~derived (); }; @@ -566,3 +569,22 @@ void test_new (void) /* TODO: placement new. */ } + +void test_methods () +{ + __emit_expression_range (0, ((base *)1)->pub () ); /* { dg-warning "range" } */ +/* { dg-begin-multiline-output "" } + __emit_expression_range (0, ((base *)1)->pub () ); + ~~~~~~~~~~~~~~~~~^~ + { dg-end-multiline-output "" } */ + + ((base *)1)->priv (); // { dg-error " is private " } +/* { dg-begin-multiline-output "" } + ((base *)1)->priv (); + ^ + { dg-end-multiline-output "" } + { dg-begin-multiline-output "" } + int priv (); + ^~~~ + { dg-end-multiline-output "" } */ +} -- 1.8.5.3