Index: cp/decl.c =================================================================== --- cp/decl.c (revision 267600) +++ cp/decl.c (working copy) @@ -5202,7 +5202,8 @@ start_decl (const cp_declarator *declarator, if (DECL_EXTERNAL (decl) && ! DECL_TEMPLATE_SPECIALIZATION (decl) /* Aliases are definitions. */ && !alias) - permerror (input_location, "declaration of %q#D outside of class is not definition", + permerror (declarator->id_loc, + "declaration of %q#D outside of class is not definition", decl); } Index: testsuite/g++.dg/diagnostic/out-of-class-redeclaration.C =================================================================== --- testsuite/g++.dg/diagnostic/out-of-class-redeclaration.C (nonexistent) +++ testsuite/g++.dg/diagnostic/out-of-class-redeclaration.C (working copy) @@ -0,0 +1,13 @@ +// Adapted from g++.old-deja/g++.law/arm8.C + +struct K { + void f(int); +}; + +void K::f(int); // { dg-error "6:declaration of .void K::f\\(int\\). outside of class" } + +struct L { + void g(int) {} +}; + +void L::g(int); // { dg-error "6:declaration of .void L::g\\(int\\). outside of class" }