diff options
author | Mark Mitchell <mark@codesourcery.com> | 1999-05-19 04:32:46 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 1999-05-19 04:32:46 +0000 |
commit | 777004694d5c8b677cb4bfa3ac457ac838c58618 (patch) | |
tree | a2fc79cb37469827755052a82158f8fb60c180ea /gcc | |
parent | 1483bddbc8ac81700a3ccd699a6ca6587d9a9712 (diff) | |
download | gcc-777004694d5c8b677cb4bfa3ac457ac838c58618.zip gcc-777004694d5c8b677cb4bfa3ac457ac838c58618.tar.gz gcc-777004694d5c8b677cb4bfa3ac457ac838c58618.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/tree.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.jason/report.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.other/qual1.C | 17 |
4 files changed, 30 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index fb8c4a1..d3d297a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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. diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index bf16fe2..dedfc2f 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -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); diff --git a/gcc/testsuite/g++.old-deja/g++.jason/report.C b/gcc/testsuite/g++.old-deja/g++.jason/report.C index d3d3392..e514ae7 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/report.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/report.C @@ -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) { diff --git a/gcc/testsuite/g++.old-deja/g++.other/qual1.C b/gcc/testsuite/g++.old-deja/g++.other/qual1.C new file mode 100644 index 0000000..6120dae --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/qual1.C @@ -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()() ); +} |