public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ppluzhnikov at google dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/60167] New: [4.9 regression] Bogus error: conflicting declaration
Date: Thu, 13 Feb 2014 05:24:00 -0000	[thread overview]
Message-ID: <bug-60167-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 60167
           Summary: [4.9 regression] Bogus error: conflicting declaration
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ppluzhnikov at google dot com

The test case below fails to compile with current trunk:
g++ (GCC) 4.9.0 20140213 (experimental)

g++ -c t.cc
t.cc:10:48: error: conflicting declaration ‘typename Foo<F>::Bar Foo<F>::cache’
 template <int& F> typename Foo<F>::Bar Foo<F>::cache;
                                                ^
t.cc:5:14: note: previous declaration as ‘Foo<F>::Bar Foo<F>::cache’
   static Bar cache;
              ^
t.cc:10:48: error: declaration of ‘Foo<F>::Bar Foo<F>::cache’ outside of class
is not definition [-fpermissive]
 template <int& F> typename Foo<F>::Bar Foo<F>::cache;
                                                ^

/// --- cut ---
template <int& F>
struct Foo {
  typedef int Bar;

  static Bar cache;
};

// template <int& F> int Foo<F>::cache;  // OK

template <int& F> typename Foo<F>::Bar Foo<F>::cache;

/// --- cut ---

Removing reference (template <int F> struct Foo) also makes it compile.

Compiles fine with gcc-4.8 and Clang.
>From gcc-bugs-return-443426-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Feb 13 05:40:15 2014
Return-Path: <gcc-bugs-return-443426-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 16380 invoked by alias); 13 Feb 2014 05:40:15 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 16344 invoked by uid 48); 13 Feb 2014 05:40:10 -0000
From: "ashish.sadanandan at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/60168] New: Incorrect check in ~unique_ptr() when Deleter::pointer type is not a pointer type
Date: Thu, 13 Feb 2014 05:40:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.8.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: ashish.sadanandan at gmail dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter
Message-ID: <bug-60168-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-02/txt/msg01183.txt.bz2
Content-length: 1091

http://gcc.gnu.org/bugzilla/show_bug.cgi?id`168

            Bug ID: 60168
           Summary: Incorrect check in ~unique_ptr() when Deleter::pointer
                    type is not a pointer type
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ashish.sadanandan at gmail dot com

The following compiles on both VS2013 and ICC 13.0.1

#include <memory>

struct del
{
    using pointer = int;
    void operator()(int) {}
};

int main()
{
    std::unique_ptr<int, del> p;
}

It fails on gcc4.8.1 with this error

/usr/include/c++/4.8/bits/unique_ptr.h: In instantiation of
'std::unique_ptr<_Tp, _Dp>::~unique_ptr() [with _Tp = int; _Dp = del]':

main.cpp:13:35:   required from here

/usr/include/c++/4.8/bits/unique_ptr.h:183:12: error: invalid operands of types
'int' and 'std::nullptr_t' to binary 'operator!='

  if (__ptr != nullptr)

I believe that last if statement should be

    if (__ptr != pointer())


             reply	other threads:[~2014-02-13  5:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-13  5:24 ppluzhnikov at google dot com [this message]
2014-02-21  5:05 ` [Bug c++/60167] [4.8/4.9 " jason at gcc dot gnu.org
2014-02-21  5:05 ` jason at gcc dot gnu.org
2014-02-21 13:31 ` [Bug c++/60167] [4.9 " jason at gcc dot gnu.org
2014-02-21 14:01 ` jason at gcc dot gnu.org
2014-02-21 14:29 ` jakub at gcc dot gnu.org
2014-02-21 21:07 ` reichelt at gcc dot gnu.org
2014-07-31 15:55 ` jason at gcc dot gnu.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-60167-4@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).