diff options
author | Simon Martin <simartin@users.sourceforge.net> | 2007-02-12 22:17:06 +0000 |
---|---|---|
committer | Simon Martin <simartin@gcc.gnu.org> | 2007-02-12 22:17:06 +0000 |
commit | 8ea6dfaef4e67c1a505b1d7760a4fbac5f57bc36 (patch) | |
tree | 6eec4be017606e31d96f1ea0e5048763ddd6d267 /gcc/cp | |
parent | 0f7b6776a325fafa3244019a7b995ec9045573d0 (diff) | |
download | gcc-8ea6dfaef4e67c1a505b1d7760a4fbac5f57bc36.zip gcc-8ea6dfaef4e67c1a505b1d7760a4fbac5f57bc36.tar.gz gcc-8ea6dfaef4e67c1a505b1d7760a4fbac5f57bc36.tar.bz2 |
re PR c++/14622 (type mismatch in explicit template instantiation not detected)
PR c++/14622
* pt.c (do_decl_instantiation): Detect type mismatches in explicit
instantiations for variables.
Co-Authored-By: Mark Mitchell <mark@codesourcery.com>
From-SVN: r121864
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/pt.c | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 95bcd26..b7d5973 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2007-02-12 Simon Martin <simartin@users.sourceforge.net> + Mark Mitchell <mark@codesourcery.com> + + PR c++/14622 + * pt.c (do_decl_instantiation): Detect type mismatches in explicit + instantiations for variables. + 2007-02-12 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR middle-end/7651 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 078d433..ee8db6d 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -11728,6 +11728,13 @@ do_decl_instantiation (tree decl, tree storage) error ("no matching template for %qD found", decl); return; } + if (!same_type_p (TREE_TYPE (result), TREE_TYPE (decl))) + { + error ("type %qT for explicit instantiation %qD does not match " + "declared type %qT", TREE_TYPE (result), decl, + TREE_TYPE (decl)); + return; + } } else if (TREE_CODE (decl) != FUNCTION_DECL) { |