diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-05-09 03:57:53 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-05-09 03:57:53 +0000 |
commit | 7821c8c80c254f0dfd2a39f089d5bb1aa1bbed06 (patch) | |
tree | 4848895c505eb559dcf8278af01ea5362177be99 /gcc | |
parent | 43bf72ffb0e8502f5c0bd0d78a445e8e91da7aa5 (diff) | |
download | gcc-7821c8c80c254f0dfd2a39f089d5bb1aa1bbed06.tar.gz |
PR c++/57068
* decl.c (grokdeclarator): Warn about ref-qualifiers here.
* parser.c (cp_parser_ref_qualifier_seq_opt): Not here.
* error.c (maybe_warn_cpp0x): s/0x/11/.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@198730 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/decl.c | 1 | ||||
-rw-r--r-- | gcc/cp/error.c | 4 | ||||
-rw-r--r-- | gcc/cp/parser.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/parse/ref-qual1.C | 29 |
5 files changed, 39 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b9e7e61b5eb..560b463efd0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2013-05-08 Jason Merrill <jason@redhat.com> + + PR c++/57068 + * decl.c (grokdeclarator): Warn about ref-qualifiers here. + * parser.c (cp_parser_ref_qualifier_seq_opt): Not here. + * error.c (maybe_warn_cpp0x): s/0x/11/. + 2013-05-08 Paolo Carlini <paolo.carlini@oracle.com> PR c++/51226 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 12703d583da..d6e286184a4 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -9563,6 +9563,7 @@ grokdeclarator (const cp_declarator *declarator, if (rqual) { + maybe_warn_cpp0x (CPP0X_REF_QUALIFIER); error ((flags == DTOR_FLAG) ? "destructors may not be ref-qualified" : "constructors may not be ref-qualified"); diff --git a/gcc/cp/error.c b/gcc/cp/error.c index c57a5aaa8db..bd463eaa80f 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -3394,7 +3394,7 @@ maybe_warn_cpp0x (cpp0x_warn_str str) break; case CPP0X_AUTO: pedwarn (input_location, 0, - "C++0x auto only available with -std=c++11 or -std=gnu++11"); + "C++11 auto only available with -std=c++11 or -std=gnu++11"); break; case CPP0X_SCOPED_ENUMS: pedwarn (input_location, 0, @@ -3443,7 +3443,7 @@ maybe_warn_cpp0x (cpp0x_warn_str str) case CPP0X_REF_QUALIFIER: pedwarn (input_location, 0, "ref-qualifiers " - "only available with -std=c++0x or -std=gnu++0x"); + "only available with -std=c++11 or -std=gnu++11"); break; default: gcc_unreachable (); diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 6de8e1a4868..8d3f6c70fff 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -17199,9 +17199,6 @@ cp_parser_ref_qualifier_opt (cp_parser* parser) } } - if (ref_qual) - maybe_warn_cpp0x (CPP0X_REF_QUALIFIER); - return ref_qual; } diff --git a/gcc/testsuite/g++.dg/parse/ref-qual1.C b/gcc/testsuite/g++.dg/parse/ref-qual1.C new file mode 100644 index 00000000000..e3f60c09c8a --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/ref-qual1.C @@ -0,0 +1,29 @@ +// PR c++/57068 + +enum Enums { + Enum1 = 0x00000000, + Enum2 = 0x00000001 +}; + +class Flags { +public: + Flags() : i(0) {} + Flags(int i): i(i) {} + Flags operator&(Enums f) { return Flags(Enums(i & f)); } + + operator bool() { return i; } +private: + int i; +}; + +Flags windowState() +{ + return Flags(); +} + +int main() +{ + if (bool(windowState() & Enum1) == true) + return 1; + return 0; +} |