This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/24375] Wrong line number in diagnostic
- From: "manu at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 27 Jan 2016 19:45:07 +0000
- Subject: [Bug c++/24375] Wrong line number in diagnostic
- Auto-submitted: auto-generated
- References: <bug-24375-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=24375
Manuel LÃpez-IbÃÃez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |manu at gcc dot gnu.org
--- Comment #4 from Manuel LÃpez-IbÃÃez <manu at gcc dot gnu.org> ---
The reason is the in-class initializer. Move it and the previous definition
changes.
prog.cc:8:21: error: redefinition of 'const int foo<int>::u'
const int foo<int>::u;
^
prog.cc:6:11: note: 'const int foo<int>::u' previously defined here
const int foo<int>::u = 0;
^~~~~~~~
I think it may be because of this code:
/* Merge the initialization information. */
if (DECL_INITIAL (newdecl) == NULL_TREE
&& DECL_INITIAL (olddecl) != NULL_TREE)
{
DECL_INITIAL (newdecl) = DECL_INITIAL (olddecl);
DECL_SOURCE_LOCATION (newdecl) = DECL_SOURCE_LOCATION (olddecl);
if (TREE_CODE (newdecl) == FUNCTION_DECL)
{
DECL_SAVED_TREE (newdecl) = DECL_SAVED_TREE (olddecl);
DECL_STRUCT_FUNCTION (newdecl) = DECL_STRUCT_FUNCTION (olddecl);
}
}