public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58740] New: incorrect access check of static base class member in derived template class
@ 2013-10-15 20:46 lhyatt at gmail dot com
  2013-10-15 21:22 ` [Bug c++/58740] " redi at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: lhyatt at gmail dot com @ 2013-10-15 20:46 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58740
           Summary: incorrect access check of static base class member in
                    derived template class
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lhyatt at gmail dot com

///////////////
class A {
    static int p;
};
int A::p = 0;
template<int=0>
struct B : A {
    B() {(void)p;}
};
int main() {
    B<>();
}
///////////////

This should fail to compile as A::p is private, but gcc accepts it.

$ g++ -v t.cpp
Using built-in specs.
COLLECT_GCC=/usr/local/gcc48/bin/g++
COLLECT_LTO_WRAPPER=/usr/local/gcc-4.8.1/libexec/gcc/x86_64-unknown-linux-gnu/4.8.1/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ./configure --enable-threads=posix --enable-__cxa_atexit
--prefix=/usr/local/gcc-4.8.1
Thread model: posix
gcc version 4.8.1 (GCC)
COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/local/gcc-4.8.1/libexec/gcc/x86_64-unknown-linux-gnu/4.8.1/cc1plus -quiet
-v -D_GNU_SOURCE t.cpp -quiet -dumpbase t.cpp -mtune=generic -march=x86-64
-auxbase t -version -o /tmp/ccwT0oUt.s
GNU C++ (GCC) version 4.8.1 (x86_64-unknown-linux-gnu)
    compiled by GNU C version 4.8.1, GMP version 4.3.2, MPFR version 2.4.2-p1,
MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory
"/usr/local/gcc-4.8.1/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../x86_64-unknown-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:

/usr/local/gcc-4.8.1/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../include/c++/4.8.1

/usr/local/gcc-4.8.1/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../include/c++/4.8.1/x86_64-unknown-linux-gnu

/usr/local/gcc-4.8.1/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../include/c++/4.8.1/backward
 /usr/local/gcc-4.8.1/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/include
 /usr/local/include
 /usr/local/gcc-4.8.1/include
 /usr/local/gcc-4.8.1/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/include-fixed
 /usr/include
End of search list.
GNU C++ (GCC) version 4.8.1 (x86_64-unknown-linux-gnu)
    compiled by GNU C version 4.8.1, GMP version 4.3.2, MPFR version 2.4.2-p1,
MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 9381368e685e312c931bb6a2db2d568c
COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 as -v --64 -o /tmp/cciB1xZN.o /tmp/ccwT0oUt.s
GNU assembler version 2.20.1 (x86_64-linux-gnu) using BFD version (GNU Binutils
for Ubuntu) 2.20.1-system.20100303
COMPILER_PATH=/usr/local/gcc-4.8.1/libexec/gcc/x86_64-unknown-linux-gnu/4.8.1/:/usr/local/gcc-4.8.1/libexec/gcc/x86_64-unknown-linux-gnu/4.8.1/:/usr/local/gcc-4.8.1/libexec/gcc/x86_64-unknown-linux-gnu/:/usr/local/gcc-4.8.1/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/:/usr/local/gcc-4.8.1/lib/gcc/x86_64-unknown-linux-gnu/
LIBRARY_PATH=/usr/local/gcc-4.8.1/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/:/usr/local/gcc-4.8.1/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/local/gcc-4.8.1/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/local/gcc-4.8.1/libexec/gcc/x86_64-unknown-linux-gnu/4.8.1/collect2
--eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2
/usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o
/usr/local/gcc-4.8.1/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/crtbegin.o
-L/usr/local/gcc-4.8.1/lib/gcc/x86_64-unknown-linux-gnu/4.8.1
-L/usr/local/gcc-4.8.1/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../lib64
-L/lib/../lib64 -L/usr/lib/../lib64
-L/usr/local/gcc-4.8.1/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../..
/tmp/cciB1xZN.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc
/usr/local/gcc-4.8.1/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/crtend.o
/usr/lib/../lib64/crtn.o


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

* [Bug c++/58740] incorrect access check of static base class member in derived template class
  2013-10-15 20:46 [Bug c++/58740] New: incorrect access check of static base class member in derived template class lhyatt at gmail dot com
@ 2013-10-15 21:22 ` redi at gcc dot gnu.org
  2015-07-08 16:54 ` barry.revzin at gmail dot com
  2021-08-27 18:15 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2013-10-15 21:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
There are loads opf existing bugs regarding the lack of access checking in
templates, this is almost certainly a dup of one of them


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

* [Bug c++/58740] incorrect access check of static base class member in derived template class
  2013-10-15 20:46 [Bug c++/58740] New: incorrect access check of static base class member in derived template class lhyatt at gmail dot com
  2013-10-15 21:22 ` [Bug c++/58740] " redi at gcc dot gnu.org
@ 2015-07-08 16:54 ` barry.revzin at gmail dot com
  2021-08-27 18:15 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: barry.revzin at gmail dot com @ 2015-07-08 16:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58740

Barry Revzin <barry.revzin at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |barry.revzin at gmail dot com

--- Comment #2 from Barry Revzin <barry.revzin at gmail dot com> ---
For what it's worth, this still compiles in 5.1.


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

* [Bug c++/58740] incorrect access check of static base class member in derived template class
  2013-10-15 20:46 [Bug c++/58740] New: incorrect access check of static base class member in derived template class lhyatt at gmail dot com
  2013-10-15 21:22 ` [Bug c++/58740] " redi at gcc dot gnu.org
  2015-07-08 16:54 ` barry.revzin at gmail dot com
@ 2021-08-27 18:15 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-27 18:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58740

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 41437 and fixed for GCC 11+.

*** This bug has been marked as a duplicate of bug 41437 ***

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

end of thread, other threads:[~2021-08-27 18:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-15 20:46 [Bug c++/58740] New: incorrect access check of static base class member in derived template class lhyatt at gmail dot com
2013-10-15 21:22 ` [Bug c++/58740] " redi at gcc dot gnu.org
2015-07-08 16:54 ` barry.revzin at gmail dot com
2021-08-27 18:15 ` pinskia at gcc dot gnu.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).