public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/57831] New: pointer to member function inaccessible through using statement (or ICE)
@ 2013-07-05 17:44 t-gcc-bugzilla at snowelm dot com
  2013-07-05 18:22 ` [Bug c++/57831] [4.7/4.8/4.9 Regression] " paolo.carlini at oracle dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: t-gcc-bugzilla at snowelm dot com @ 2013-07-05 17:44 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 57831
           Summary: pointer to member function inaccessible through using
                    statement (or ICE)
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: t-gcc-bugzilla at snowelm dot com

g++ 4.8.1 rejects the following code saying "B<T>::base::f is inaccessible". 
I believe the code is valid (and compiled without error by Clang).
Moreover, when I use the trunk head g++, it crashes with ICE.
----------------------------
struct A {
  void f();
};
template <class T> struct B : T {
  typedef T base;
  using base::f;         // If I write "using B<T>::f" it's ok
  void g( ) {
    B<T>::f();           // This is OK as expected
    (this->*&T::f)();    // This is also OK
    (this->*&B<T>::f)(); // This causes error
  }
};
template struct B< A >;
----------------------------
It is strange to see "inaccessible" error, since everything in the code is
public.
The oldest g++ in my environment (g++ 4.4) also rejects the code.
Coupiler output for g++ 4.8.1 and g++ trunk are attached below
Possibly related to PR 57658 or PR 53549.

------------------------------
$ g++-4.8 -v
Using built-in specs.
COLLECT_GCC=g++-4.8
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.8.1/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --prefix=/usr/local --program-suffix=-4.8
--enable-languages=c,c++,lto
Thread model: posix
gcc version 4.8.1 (GCC)
$ g++-4.8 hoge.ii
hoge.ii: In instantiation of 'void B<T>::g() [with T = A]':
hoge.ii:13:17:   required from here
hoge.ii:6:14: error: 'using B<T>::base::f' is inaccessible
  using base::f;
              ^
hoge.ii:10:13: error: within this context
     (this->*&B<T>::f)();
             ^
hoge.ii:10:10: error: pointer to member type 'B<T>::base' incompatible with
object type 'B<A>'
     (this->*&B<T>::f)();
------------------------------
$ g++-4.9 -v
Using built-in specs.
COLLECT_GCC=g++-4.9
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --prefix=/usr/local --program-suffix=-4.9
--enable-languages=c,c++,lto
Thread model: posix
gcc version 4.9.0 20130705 (experimental) (GCC)
$ g++-4.9 hoge.ii
hoge.ii: In instantiation of 'void B<T>::g() [with T = A]':
hoge.ii:13:17:   required from here
hoge.ii:10:13: internal compiler error: in tsubst_copy, at cp/pt.c:12616
     (this->*&B<T>::f)();
             ^
0x59f08b tsubst_copy
        ../../gcc/cp/pt.c:12616
0x5b4bb9 tsubst_qualified_id
        ../../gcc/cp/pt.c:12013
0x58062b tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../gcc/cp/pt.c:13684
0x57f906 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../gcc/cp/pt.c:13738
0x57e66b tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../gcc/cp/pt.c:14013
0x5874f2 tsubst_expr
        ../../gcc/cp/pt.c:13429
0x587a4f tsubst_expr
        ../../gcc/cp/pt.c:12908
0x586f93 tsubst_expr
        ../../gcc/cp/pt.c:12894
0x587d64 tsubst_expr
        ../../gcc/cp/pt.c:13084
0x5858bc instantiate_decl(tree_node*, int, bool)
        ../../gcc/cp/pt.c:19157
0x5c14ff instantiate_pending_templates(int)
        ../../gcc/cp/pt.c:19256
0x5fd809 cp_write_global_declarations()
        ../../gcc/cp/decl2.c:4063
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
------------------------------


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

* [Bug c++/57831] [4.7/4.8/4.9 Regression] pointer to member function inaccessible through using statement (or ICE)
  2013-07-05 17:44 [Bug c++/57831] New: pointer to member function inaccessible through using statement (or ICE) t-gcc-bugzilla at snowelm dot com
@ 2013-07-05 18:22 ` paolo.carlini at oracle dot com
  2013-07-09  3:47 ` jason at gcc dot gnu.org
  2013-07-09 18:50 ` jason at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-07-05 18:22 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-07-05
            Summary|pointer to member function  |[4.7/4.8/4.9 Regression]
                   |inaccessible through using  |pointer to member function
                   |statement (or ICE)          |inaccessible through using
                   |                            |statement (or ICE)
     Ever confirmed|0                           |1

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Yeah, annoying but isn't a recent (4.3.6 worked) regression.


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

* [Bug c++/57831] [4.7/4.8/4.9 Regression] pointer to member function inaccessible through using statement (or ICE)
  2013-07-05 17:44 [Bug c++/57831] New: pointer to member function inaccessible through using statement (or ICE) t-gcc-bugzilla at snowelm dot com
  2013-07-05 18:22 ` [Bug c++/57831] [4.7/4.8/4.9 Regression] " paolo.carlini at oracle dot com
@ 2013-07-09  3:47 ` jason at gcc dot gnu.org
  2013-07-09 18:50 ` jason at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jason at gcc dot gnu.org @ 2013-07-09  3:47 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |jason at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org


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

* [Bug c++/57831] [4.7/4.8/4.9 Regression] pointer to member function inaccessible through using statement (or ICE)
  2013-07-05 17:44 [Bug c++/57831] New: pointer to member function inaccessible through using statement (or ICE) t-gcc-bugzilla at snowelm dot com
  2013-07-05 18:22 ` [Bug c++/57831] [4.7/4.8/4.9 Regression] " paolo.carlini at oracle dot com
  2013-07-09  3:47 ` jason at gcc dot gnu.org
@ 2013-07-09 18:50 ` jason at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jason at gcc dot gnu.org @ 2013-07-09 18:50 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |4.7.4

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 4.7.4/4.8.2/4.9.


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

end of thread, other threads:[~2013-07-09 18:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-05 17:44 [Bug c++/57831] New: pointer to member function inaccessible through using statement (or ICE) t-gcc-bugzilla at snowelm dot com
2013-07-05 18:22 ` [Bug c++/57831] [4.7/4.8/4.9 Regression] " paolo.carlini at oracle dot com
2013-07-09  3:47 ` jason at gcc dot gnu.org
2013-07-09 18:50 ` jason 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).