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
This commit is contained in:
Mark Mitchell 1999-05-19 04:32:46 +00:00 committed by Mark Mitchell
parent 1483bddbc8
commit 777004694d
4 changed files with 30 additions and 2 deletions

View File

@ -1,3 +1,8 @@
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.

View File

@ -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);

View File

@ -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)
{

View File

@ -0,0 +1,17 @@
// 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()() );
}