diff options
author | Paolo Carlini <paolo@gcc.gnu.org> | 2015-06-15 19:26:27 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2015-06-15 19:26:27 +0000 |
commit | f92c74268a1f3e9ff6921097e8da418879769e2b (patch) | |
tree | d605b269cba55a56fd16eafdd94e47cdc5fd7eef /gcc/cp | |
parent | d7bfc710ab444e1a4e2ebe7e0ba8e39ffc3f8a08 (diff) | |
download | gcc-f92c74268a1f3e9ff6921097e8da418879769e2b.zip gcc-f92c74268a1f3e9ff6921097e8da418879769e2b.tar.gz gcc-f92c74268a1f3e9ff6921097e8da418879769e2b.tar.bz2 |
re PR c++/51048 (Class template inheritance doesn't work well with function-local types)
/cp
2015-06-15 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51048
* decl2.c (no_linkage_error): Do not issue a permerror if the DECL
using a local type is pure virtual.
/testsuite
2015-06-15 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51048
* g++.dg/cpp0x/local-type1.C: New.
From-SVN: r224492
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 8 |
2 files changed, 12 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e1ca26e..cf311c7 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2015-06-15 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/51048 + * decl2.c (no_linkage_error): Do not issue a permerror if the DECL + using a local type is pure virtual. + 2015-06-13 Patrick Palka <ppalka@gcc.gnu.org> * call.c: Remove comment documenting the long-deleted diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 9df3139..ce7ab52 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -4221,8 +4221,12 @@ no_linkage_error (tree decl) TYPE_NAME (t)); } else if (cxx_dialect >= cxx11) - permerror (DECL_SOURCE_LOCATION (decl), "%q#D, declared using local type " - "%qT, is used but never defined", decl, t); + { + if (TREE_CODE (decl) == VAR_DECL || !DECL_PURE_VIRTUAL_P (decl)) + permerror (DECL_SOURCE_LOCATION (decl), + "%q#D, declared using local type " + "%qT, is used but never defined", decl, t); + } else if (TREE_CODE (decl) == VAR_DECL) warning_at (DECL_SOURCE_LOCATION (decl), 0, "type %qT with no linkage " "used to declare variable %q#D with linkage", t, decl); |