stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Sebor (JIRA)" <j...@apache.org>
Subject [jira] Created: (STDCXX-445) [HP aCC 3, 5] bogus error 331 on const_cast of this in template specialization
Date Fri, 08 Jun 2007 17:53:25 GMT
[HP aCC 3, 5] bogus error 331 on const_cast of this in template specialization
------------------------------------------------------------------------------

                 Key: STDCXX-445
                 URL: https://issues.apache.org/jira/browse/STDCXX-445
             Project: C++ Standard Library
          Issue Type: Bug
          Components: External
         Environment: aCC 3 and 5
            Reporter: Martin Sebor


Copied from Rogue Wave bug database:

****Created By: sebor @ Jan 03, 2002 06:05:35 PM****
Subject: aCC 3.32 unable to const_cast this in a specialization
Date: Thu, 03 Jan 2002 18:05:19 -0700
From: Martin Sebor <sebor@roguewave.com>
Organization: Rogue Wave Software, Inc.
To: HP aCC mailing list <acxx-beta@cup.hp.com>

...and here's the const_cast bug that triggered the ICE (see PR #27086).

Martin


$ cat t.cpp ; aCC -c -V t.cpp
template <class T> struct S;

template <>
struct S<int> {
   int i;

   int foo () const;
};

int S<int>::foo () const {
   if (i)
       return 0;

   return const_cast<S*>(this)->i = 0;
}


aCC: HP ANSI C++ B3910B X.03.32
Error 331: "t.cpp", line 14 # Illegal cast expression; cannot cast expression
type '<no type>' to 'int'.
       return const_cast<S*>(this)->i = 0;
                             ^^^^^^^^^^^^
****Modified By: sebor @ Jan 04, 2002 11:36:34 AM****
Subject: Re: aCC 3.32 unable to const_cast this in a specialization
Date: Fri, 04 Jan 2002 11:35:54 -0700
From: Martin Sebor <sebor@roguewave.com>
Organization: Rogue Wave Software, Inc.
To: acxx-beta@cup.hp.com
References: 1

Dennis Handly wrote:
>
> >...and here's the const_cast bug that triggered the ICE.
> Martin
>
> Are you sure this is legal?  (kcc does like it.)
> S<int> in this case is a normal class since it is explicitly specialized.
> I would think that S* is referring to the template and not S<int>.

Why would you think that? I'm not aware of any special rule for
explicit specializations. I think such a rule would be very odd.

>
> Or is S* found by the normal look up rules which has nothing to do with
> whether it is explicitly specialized or not?
> (Alain, is this right?)

I believe so (I can't find the text but all other compilers behave
that way). If not, then our (and yours as well) <complex> has some
serious problems.

Martin
****Modified By: sebor @ Nov 12, 2002 12:53:18 PM****
-------- Original Message --------
Subject: Re: aCC 3.32 unable to const_cast this in a specialization
Date: Tue, 12 Nov 2002 12:52:40 -0700
From: Martin Sebor <sebor@roguewave.com>
Organization: Rogue Wave Software, Inc.
To: Dennis Handly <dhandly@cup.hp.com>
CC: acxx-beta@cup.hp.com
References: <200201040523.VAA04541@hpcll183.cup.hp.com>

Dennis Handly wrote:
>>...and here's the const_cast bug that triggered the ICE.
>
> Martin
>
> Are you sure this is legal?  (kcc does like it.)
> S<int> in this case is a normal class since it is explicitly specialized.
> I would think that S* is referring to the template and not S<int>.
>
> Or is S* found by the normal look up rules which has nothing to do with
> whether it is explicitly specialized or not?
> (Alain, is this right?)

Dennis, this is still a problem in 5.38. I'm not sure you have it
in your database (I don't think I got a bug number from you).
Here's another test case.

Thanks
Martin


$ cat t.cpp; aCC -V -AA -c t.cpp
template <class T> struct S;

template <>
struct S<int> {
    int i;

    void foo () {
        S *s = this;
        this->S::i = 0;   // okay
        s->i = 0;         // okay
    }

    void bar ();
};

void S<int>::bar () {
    S *s = this;
    this->S::i = 0;   // okay
    s->i = 0;         // error
}

aCC: HP aC++/ANSI C B3910B A.05.38 [Sep 12 2002]
Error 359: "t.cpp", line 19 # The expression on the left side of the
'->' (arrow member access operator) must be a pointer to completed class
object type; the type of the left side is 'S *' and 'struct S' has not
been defined yet.
        s->i = 0;         // error
        ^
****Modified By: sebor @ Nov 14, 2002 09:58:50 AM****
-------- Original Message --------
Subject: Re: aCC 3.32 unable to const_cast this in a specialization
Date: Wed, 13 Nov 2002 23:29:22 -0800 (PST)
From: Dennis Handly <dhandly@cup.hp.com>
To: sebor@roguewave.com
CC: acxx-beta@cup.hp.com

>this is still a problem in 5.38.  I'm not sure you have it in your
>database (I don't think I got a bug number from you).
Martin

At the time, Jan 4, I said I would add it to the one we were talking about
just before that.

CR JAGae01381
Error 331 or Assert in Expand.C 6499 cast to template name without args



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message