[Bug c++/22452] [4.1 regression] ICE expected tree that contains 'decl with visibility' structure, have 'const_decl' in decl_linkage, at cp/tree.c:2132

gdr at integrable-solutions dot net gcc-bugzilla@gcc.gnu.org
Thu Jul 14 19:38:00 GMT 2005


------- Additional Comments From gdr at integrable-solutions dot net  2005-07-14 19:36 -------
Subject: Re:  [4.1 regression] ICE expected tree that contains 'decl with visibility' structure, have 'const_decl'  in decl_linkage, at cp/tree.c:2132

"dberlin at dberlin dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| ------- Additional Comments From dberlin at gcc dot gnu dot org  2005-07-14 16:03 -------
| Subject: Re:  [4.1 regression] ICE expected tree that
| 	contains 'decl with visibility' structure, have 'const_decl'  in
| 	decl_linkage, at cp/tree.c:2132
| 
| 
| > | fixing.
| > 
| > Please look at section 3.5 before fixing this.  
| > (besides an numeration does not have storage).
| > 
| I am not a C++ expert.   I can't read the C++ standard well.
| 
| I simply told him what cp-tree.h said about linkage (please read it),
| and asked him what an *enumeration value* (not type) has in terms of
| linkage.


In C++:

   * an enumration is the type.
   * An enumerator is the named value

and the quote I providfed addresses explicitly the case of enumerator
(the subject of this Pr): Its linkage depends on that of its
enumeration (the type)

| I know for a *fact* that it used to return lk_internal in this testcase.

The point is that that is wrong, at least if the notion of linkage has
any relation with what C++ standard says.

(CONST_DECLs do not occupy storage; the notion of linkage has to do
with names ans uses within and across translation units).

| If you want to disagree about how to fix it, please simply look at
| decl_linkage and tell me what i am supposed to be returning for a
| CONST_DECL.

The linkage for CONST_DECL should be lk_external is its type has
lk_external linkage; it should be lk_none if its type is local,
otherwise if its type has lk_internal then it is lk_internal.

For example, in 

    namespace foo {
       enum color { red, green, blue };
    }

foo::color, foo::green and foo::bleu all have external linkage.

| 
| I really don't have the skills to play language lawyer here, my

I'm not here to play language lawyer neither; but the claim just looks
wrong to me.  Unless you define playing language lawyer as giving
asnwer you questions you raised.

| inclination is to just make it do what it used to, which is return
| lk_internal.

Then you have to test whether you can use the reulsint CONST_DECL as
template argument for example.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22452



More information about the Gcc-bugs mailing list