Commit 77700469 by Mark Mitchell Committed by Mark Mitchell

tree.c (cp_build_qualified_type): Don't allow qualified function types.

	* tree.c (cp_build_qualified_type): Don't allow qualified function
	types.

From-SVN: r27021
parent 1483bddb
1999-05-19 Mark Mitchell <mark@codesourcery.com>
* tree.c (cp_build_qualified_type): Don't allow qualified function
types.
Wed May 19 02:50:53 1999 Arvind Sankar <arvinds@mit.edu>
* gxxint.texi: Fix typo.
......
......@@ -475,7 +475,13 @@ cp_build_qualified_type (type, type_quals)
type_quals &= ~TYPE_QUAL_RESTRICT;
}
if (TREE_CODE (type) == ARRAY_TYPE)
if (type_quals != TYPE_UNQUALIFIED
&& TREE_CODE (type) == FUNCTION_TYPE)
{
cp_error ("`%T' cannot be `const'-, `volatile'-, or `restrict'-qualified", type);
type_quals = TYPE_UNQUALIFIED;
}
else if (TREE_CODE (type) == ARRAY_TYPE)
{
tree real_main_variant = TYPE_MAIN_VARIANT (type);
......
......@@ -42,7 +42,7 @@ class X{
};
typedef int const * bart ();
typedef bart const * const * bar2;
typedef bart const * const * bar2; // ERROR - qualifiers
bar2 baz (X::Y y)
{
......
// Build don't link:
// Origin: Benjamin Pflugmann <philemon@spin.de>
// Special g++ Options: -O
typedef const char *(func_type)();
class
{
public:
func_type *Function;
const func_type* function(void) { return Function; } // ERROR - qualifiers
} action;
void work(const char *source)
{
work( action.function()() );
}
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