Commit b0f36e5e by Jason Merrill Committed by Jason Merrill

re PR c++/57068 (gcc prints warning "ref-qualifiers only available with…

re PR c++/57068 (gcc prints warning "ref-qualifiers only available with -std=c++0x or -std=gnu++0x" for operator&)

	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/.

From-SVN: r198730
parent 65424645
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> 2013-05-08 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51226 PR c++/51226
......
...@@ -9563,6 +9563,7 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -9563,6 +9563,7 @@ grokdeclarator (const cp_declarator *declarator,
if (rqual) if (rqual)
{ {
maybe_warn_cpp0x (CPP0X_REF_QUALIFIER);
error ((flags == DTOR_FLAG) error ((flags == DTOR_FLAG)
? "destructors may not be ref-qualified" ? "destructors may not be ref-qualified"
: "constructors may not be ref-qualified"); : "constructors may not be ref-qualified");
......
...@@ -3394,7 +3394,7 @@ maybe_warn_cpp0x (cpp0x_warn_str str) ...@@ -3394,7 +3394,7 @@ maybe_warn_cpp0x (cpp0x_warn_str str)
break; break;
case CPP0X_AUTO: case CPP0X_AUTO:
pedwarn (input_location, 0, 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; break;
case CPP0X_SCOPED_ENUMS: case CPP0X_SCOPED_ENUMS:
pedwarn (input_location, 0, pedwarn (input_location, 0,
...@@ -3443,7 +3443,7 @@ maybe_warn_cpp0x (cpp0x_warn_str str) ...@@ -3443,7 +3443,7 @@ maybe_warn_cpp0x (cpp0x_warn_str str)
case CPP0X_REF_QUALIFIER: case CPP0X_REF_QUALIFIER:
pedwarn (input_location, 0, pedwarn (input_location, 0,
"ref-qualifiers " "ref-qualifiers "
"only available with -std=c++0x or -std=gnu++0x"); "only available with -std=c++11 or -std=gnu++11");
break; break;
default: default:
gcc_unreachable (); gcc_unreachable ();
......
...@@ -17199,9 +17199,6 @@ cp_parser_ref_qualifier_opt (cp_parser* parser) ...@@ -17199,9 +17199,6 @@ cp_parser_ref_qualifier_opt (cp_parser* parser)
} }
} }
if (ref_qual)
maybe_warn_cpp0x (CPP0X_REF_QUALIFIER);
return ref_qual; return ref_qual;
} }
......
// 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment