Commit f92c7426 by Paolo Carlini

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
parent d7bfc710
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> 2015-06-13 Patrick Palka <ppalka@gcc.gnu.org>
* call.c: Remove comment documenting the long-deleted * call.c: Remove comment documenting the long-deleted
......
...@@ -4221,8 +4221,12 @@ no_linkage_error (tree decl) ...@@ -4221,8 +4221,12 @@ no_linkage_error (tree decl)
TYPE_NAME (t)); TYPE_NAME (t));
} }
else if (cxx_dialect >= cxx11) 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) else if (TREE_CODE (decl) == VAR_DECL)
warning_at (DECL_SOURCE_LOCATION (decl), 0, "type %qT with no linkage " warning_at (DECL_SOURCE_LOCATION (decl), 0, "type %qT with no linkage "
"used to declare variable %q#D with linkage", t, decl); "used to declare variable %q#D with linkage", t, decl);
......
2015-06-15 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51048
* g++.dg/cpp0x/local-type1.C: New.
2015-06-15 Andre Vehreschild <vehre@gmx.de> 2015-06-15 Andre Vehreschild <vehre@gmx.de>
PR fortran/44672 PR fortran/44672
...@@ -11,7 +16,7 @@ ...@@ -11,7 +16,7 @@
2015-06-13 Patrick Palka <ppalka@gcc.gnu.org> 2015-06-13 Patrick Palka <ppalka@gcc.gnu.org>
PR c++/65168 PR c++/65168
g++.dg/warn/Walways-true-3.C: New test. * g++.dg/warn/Walways-true-3.C: New test.
2015-06-13 Tom de Vries <tom@codesourcery.com> 2015-06-13 Tom de Vries <tom@codesourcery.com>
......
// PR c++/51048
// { dg-do compile { target c++11 } }
template<typename X>
struct A {
virtual void DoPush(X const& x) = 0;
void Push(X const& x) { DoPush(x); }
};
template<typename X>
struct B : A<X> {
using A<X>::Push;
virtual void DoPush(X const&) { }
};
int main() {
enum S { };
B<S>().Push(S());
}
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