From e4479ec676b96445e52f47950703218162c4637a Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Thu, 28 Mar 2019 21:32:11 +0000 Subject: [PATCH] PR c++/66548 - Invalid class member access expression in decltype sometimes PR c++/66548 - Invalid class member access expression in decltype sometimes accepted gcc/testsuite/ChangeLog: * g++.dg/cpp0x/decltype-pr66548.C: New test. From-SVN: r270007 --- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/g++.dg/cpp0x/decltype-pr66548.C | 22 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype-pr66548.C diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e0832a910c2..3a8ab252b8e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2019-03-28 Martin Sebor + PR c++/66548 + * g++.dg/cpp0x/decltype-pr66548.C: New test. + PR c++/81506 * g++.dg/cpp0x/decltype-pr81506.C: New test. diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype-pr66548.C b/gcc/testsuite/g++.dg/cpp0x/decltype-pr66548.C new file mode 100644 index 00000000000..f4b7caa9eae --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype-pr66548.C @@ -0,0 +1,22 @@ +// PR c++/66548 - Invalid class member access expression in decltype +// sometimes accepted +// { dg-do compile } +// { dg-options "-ftrack-macro-expansion=0" } + +#if __cplusplus < 201103L +# define decltype __typeof__ +#endif + +struct Meow {}; + +void f () +{ + decltype (Meow.purr ()) d; // { dg-error "expected primary-expression" "pr89875" { xfail c++98_only } } + (void)&d; +} + +void g () +{ + decltype (Meow.purr); // { dg-error "expected primary-expression" } +} + -- 2.30.2