public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/39242]  New: [4.4 Regression] Inconsistent reject / accept of code
@ 2009-02-19 13:38 rguenth at gcc dot gnu dot org
  2009-02-19 13:40 ` [Bug c++/39242] " rguenth at gcc dot gnu dot org
                   ` (18 more replies)
  0 siblings, 19 replies; 20+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-02-19 13:38 UTC (permalink / raw)
  To: gcc-bugs

[-- 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


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2009-02-24 14:52 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-19 13:38 [Bug c++/39242] New: [4.4 Regression] Inconsistent reject / accept of code rguenth at gcc dot gnu dot org
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

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).