public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/39242]  New: [4.4 Regression] Inconsistent reject / accept of code
Date: Thu, 19 Feb 2009 13:38:00 -0000	[thread overview]
Message-ID: <bug-39242-10053@http.gcc.gnu.org/bugzilla/> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1857 bytes --]

With -O0 the following is accepted, with -O1 it is rejected with

Parser.3.ii: In member function ‘void RepPtrStore<_Tp, _Bt>::_assign(_Tp*)
[with _Tp = YStatement, _Bt = YCode]’:
Parser.3.ii:11:   instantiated from ‘RepPtrStore<_Tp, _Bt>::~RepPtrStore()
[with _Tp = YStatement, _Bt = YCode]’
Parser.3.ii:21:   instantiated from here
Parser.3.ii:16: error: no matching function for call to
‘Rep::unref(YStatement*&)’
Parser.3.ii:3: note: candidates are: void Rep::unref() const
Parser.3.ii:4: note:                 static void Rep::unref(const Rep*)


testcase:

class Rep {
public:
    void unref() const { }
    static void unref (const Rep * obj_r) { obj_r->unref(); }
};
template<typename _Tp, typename _Bt = _Tp>
class RepPtrStore {
    _Tp * _obj;
    void _assign( _Tp * new_r );
public:
    ~RepPtrStore() { _assign( 0 ); }
};
template<typename _Tp,typename _Bt>
void RepPtrStore<_Tp,_Bt>::_assign( _Tp * new_r )
{
  Rep::unref( _obj );
}
class RepPtrBase { };
template<typename _Bt> class PtrBase : public RepPtrBase { };
template<typename _Tp, typename _Bt = _Tp>
class Ptr : public PtrBase<_Bt> {
    RepPtrStore<_Tp,_Bt> _ptr;
};
class YCode;
class YStatement;
typedef Ptr<YStatement,YCode> YStatementPtr;
extern template class RepPtrStore<YStatement,YCode>;
class ExecutionEnvironment {
    YStatementPtr m_statement;
    ~ExecutionEnvironment() { };
};

GCC 4.3 accepts the code unconditionally, so does EDG.


-- 
           Summary: [4.4 Regression] Inconsistent reject / accept of code
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org


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


             reply	other threads:[~2009-02-19 13:38 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-19 13:38 rguenth at gcc dot gnu dot org [this message]
2009-02-19 13:40 ` [Bug c++/39242] " rguenth at gcc dot gnu dot org
2009-02-19 13:40 ` rguenth at gcc dot gnu dot org
2009-02-19 13:46 ` rguenth at gcc dot gnu dot org
2009-02-19 13:51 ` rguenth at gcc dot gnu dot org
2009-02-19 14:19 ` rguenth at gcc dot gnu dot org
2009-02-19 14:31 ` rguenth at gcc dot gnu dot org
2009-02-19 14:52 ` rguenth at gcc dot gnu dot org
2009-02-19 14:59 ` hubicka at ucw dot cz
2009-02-19 15:20 ` rguenth at gcc dot gnu dot org
2009-02-19 15:40 ` hubicka at ucw dot cz
2009-02-19 16:41 ` mark at codesourcery dot com
2009-02-19 16:55 ` rguenther at suse dot de
2009-02-19 16:59 ` rguenth at gcc dot gnu dot org
2009-02-19 17:39 ` jason at gcc dot gnu dot org
2009-02-20 14:40 ` hubicka at ucw dot cz
2009-02-21 12:55 ` rguenth at gcc dot gnu dot org
2009-02-21 13:09 ` rguenth at gcc dot gnu dot org
2009-02-24 14:51 ` rguenth at gcc dot gnu dot org
2009-02-24 14:52 ` rguenth at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-39242-10053@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).