public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/57973] New: incorrect access check for protected member of template base with using
@ 2013-07-24 21:56 rogero at howzatt dot demon.co.uk
  2013-07-24 22:32 ` [Bug c++/57973] " paolo.carlini at oracle dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: rogero at howzatt dot demon.co.uk @ 2013-07-24 21:56 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 4547 bytes --]

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

            Bug ID: 57973
           Summary: incorrect access check for protected member of
                    template base with using
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rogero at howzatt dot demon.co.uk

Created attachment 30547
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30547&action=edit
sample program -- I believe this should compile.

In a template class where a protected member of a template base class is the
subject of a using declaration, atempting to form pointer-to-member fails.

I have tested with:
   mingw g++ (niXman build) 4.7.0 20120203 (experimental)
   www.ideone.com (gcc 4.7.2)
   www.godbolt.com (gcc  4.4.7, 4.5.3, 4.6.4, 4.7.3, 4.8.1)

the program fails to compile on each with these errors:

prog.cpp: In instantiation of ‘bool D<T>::testB() const [with T = int]’:
prog.cpp:37:12:   required from here
prog.cpp:22:17: error: ‘using B<T>::bptr’ is inaccessible
prog.cpp:25:18: error: within this context

I beleive the code is correct, and it is accepted by:

clang 3.0.6
icc 13.0
msvc 12
>From gcc-bugs-return-426635-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Jul 24 21:57:03 2013
Return-Path: <gcc-bugs-return-426635-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 17270 invoked by alias); 24 Jul 2013 21:57:02 -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 17202 invoked by uid 48); 24 Jul 2013 21:57:00 -0000
From: "henner.sudek at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/57974] New: std::pow(std::complex<long double>(0),1) returns  (-nan,-nan)
Date: Wed, 24 Jul 2013 21:57: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.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: henner.sudek 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 attachments.created
Message-ID: <bug-57974-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: 2013-07/txt/msg01142.txt.bz2
Content-length: 1413

http://gcc.gnu.org/bugzilla/show_bug.cgi?idW974

            Bug ID: 57974
           Summary: std::pow(std::complex<long double>(0),1) returns
                    (-nan,-nan)
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: henner.sudek at gmail dot com

Created attachment 30548
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id0548&actioníit
the preprocessed file (*.i*) that triggers the bug

The following program gives the wrong result when compiled with the options
given below. Removing any of the compiler options gives the expected result
(0,0). I was able to reproduce the error with gcc-4.7.3, 4.8.1 and 4.9.0.

$ cat complex.cpp
#include <complex>
#include <iostream>

int main(){
  std::cerr << std::pow(std::complex<long double>(0),1) << std::endl;
}

$ c++ -std=c++11 -fno-math-errno -funsafe-math-optimizations complex.cpp
$ ./a.out
(-nan,-nan)

$ /home/henner/gcc-4.9.0/bin/g++ -v
Using built-in specs.
COLLECT_GCC=/home/henner/gcc-4.9.0/bin/g++
COLLECT_LTO_WRAPPER=/home/henner/gcc-4.9.0/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --prefix=/home/henner/gcc-4.9.0
Thread model: posix
gcc version 4.9.0 20130724 (experimental) (GCC)


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

* [Bug c++/57973] incorrect access check for protected member of template base with using
  2013-07-24 21:56 [Bug c++/57973] New: incorrect access check for protected member of template base with using rogero at howzatt dot demon.co.uk
@ 2013-07-24 22:32 ` paolo.carlini at oracle dot com
  2013-07-24 22:47 ` rogero at howzatt dot demon.co.uk
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-07-24 22:32 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
      Known to work|                            |4.8.2, 4.9.0
         Resolution|---                         |FIXED

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Already fixed in 4.8.2 and mainline.


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

* [Bug c++/57973] incorrect access check for protected member of template base with using
  2013-07-24 21:56 [Bug c++/57973] New: incorrect access check for protected member of template base with using rogero at howzatt dot demon.co.uk
  2013-07-24 22:32 ` [Bug c++/57973] " paolo.carlini at oracle dot com
@ 2013-07-24 22:47 ` rogero at howzatt dot demon.co.uk
  2013-09-24 14:49 ` dyjay_love at 126 dot com
  2013-09-25  0:24 ` dyjay_love at 126 dot com
  3 siblings, 0 replies; 5+ messages in thread
From: rogero at howzatt dot demon.co.uk @ 2013-07-24 22:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Roger Orr <rogero at howzatt dot demon.co.uk> ---
Thank you. Aoplogies for the noise.


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

* [Bug c++/57973] incorrect access check for protected member of template base with using
  2013-07-24 21:56 [Bug c++/57973] New: incorrect access check for protected member of template base with using rogero at howzatt dot demon.co.uk
  2013-07-24 22:32 ` [Bug c++/57973] " paolo.carlini at oracle dot com
  2013-07-24 22:47 ` rogero at howzatt dot demon.co.uk
@ 2013-09-24 14:49 ` dyjay_love at 126 dot com
  2013-09-25  0:24 ` dyjay_love at 126 dot com
  3 siblings, 0 replies; 5+ messages in thread
From: dyjay_love at 126 dot com @ 2013-09-24 14:49 UTC (permalink / raw)
  To: gcc-bugs

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

caroline <dyjay_love at 126 dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dyjay_love at 126 dot com

--- Comment #3 from caroline <dyjay_love at 126 dot com> ---
Dose someone knows how this bug been fixed in  4.8.2?


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

* [Bug c++/57973] incorrect access check for protected member of template base with using
  2013-07-24 21:56 [Bug c++/57973] New: incorrect access check for protected member of template base with using rogero at howzatt dot demon.co.uk
                   ` (2 preceding siblings ...)
  2013-09-24 14:49 ` dyjay_love at 126 dot com
@ 2013-09-25  0:24 ` dyjay_love at 126 dot com
  3 siblings, 0 replies; 5+ messages in thread
From: dyjay_love at 126 dot com @ 2013-09-25  0:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from caroline <dyjay_love at 126 dot com> ---
(In reply to caroline from comment #3)
> Dose someone know how this bug been fixed in  4.8.2?


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

end of thread, other threads:[~2013-09-25  0:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-24 21:56 [Bug c++/57973] New: incorrect access check for protected member of template base with using rogero at howzatt dot demon.co.uk
2013-07-24 22:32 ` [Bug c++/57973] " paolo.carlini at oracle dot com
2013-07-24 22:47 ` rogero at howzatt dot demon.co.uk
2013-09-24 14:49 ` dyjay_love at 126 dot com
2013-09-25  0:24 ` dyjay_love at 126 dot com

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