public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/50365] New: invalid use of non-static data member not suppressed by -fpermissive
@ 2011-09-12 13:32 howarth at nitro dot med.uc.edu
  2011-09-12 13:47 ` [Bug c++/50365] " howarth at nitro dot med.uc.edu
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: howarth at nitro dot med.uc.edu @ 2011-09-12 13:32 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 50365
           Summary: invalid use of non-static data member not suppressed
                    by -fpermissive
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: howarth@nitro.med.uc.edu


Created attachment 25248
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25248
preprocessed source file for common/xplorSimulation.cc

Current gcc trunk produces the compile time error (not present in gcc 4.6 or
earlier) when compiling common/xplorSimulation.cc from xplor-nih 2.27...

[MacPro:~/xplor-nih-2.27/common/bin.Darwin_11_x86_64] howarth% g++-fsf-4.7 -c
xplorSimulation.cc -O3 -ffast-math -funroll-loops -g -DX_MMAP_FLAGS=0
-DFORTRAN_INIT -fno-common -DDARWIN -D_REENTRANT -DNDEBUG
-I/Users/howarth/xplor-nih-2.27/common/
-I/Users/howarth/xplor-nih-2.27/arch/Darwin_11_x86_64/include
-I/Users/howarth/xplor-nih-2.27/CDSlib -I/Users/howarth/xplor-nih-2.27/intVar
-I/Users/howarth/xplor-nih-2.27/pcre -DCPLUSPLUS -DUSE_CDS_NAMESPACE
-I/Users/howarth/xplor-nih-2.27/common/
-I/Users/howarth/xplor-nih-2.27/arch/Darwin_11_x86_64/include
xplorSimulation.cc: In constructor ‘XplorSimulation::XplorSimulation(bool)’:
xplorSimulation.cc:53:26: error: cannot call member function ‘XplorVars*
XplorSimulation::xplorVars()’ without object
/Users/howarth/xplor-nih-2.27/common/xplorSimulation.hh:138:7: error: invalid
use of non-static data member ‘XplorSimulation::scriptingIndex_’
xplorSimulation.cc:54:6: error: from this location
/Users/howarth/xplor-nih-2.27/common/xplorSimulation.hh:138:7: error: invalid
use of non-static data member ‘XplorSimulation::scriptingIndex_’
xplorSimulation.cc:56:7: error: from this location

which isn't suppressed with -fpermissive...

[MacPro:~/xplor-nih-2.27/common/bin.Darwin_11_x86_64] howarth% g++-fsf-4.7 -c
xplorSimulation.ii -O3 -ffast-math -funroll-loops -g -fpermissive 
-DX_MMAP_FLAGS=0 -DFORTRAN_INIT -fno-common  -DDARWIN -D_REENTRANT -DNDEBUG
-DCPLUSPLUS -DUSE_CDS_NAMESPACExplorSimulation.cc: In constructor
‘XplorSimulation::XplorSimulation(bool)’:xplorSimulation.cc:53:26: error:
cannot call member function ‘XplorVars* XplorSimulation::xplorVars()’ without
object/Users/howarth/xplor-nih-2.27/common/xplorSimulation.hh:138:7: error:
invalid use of non-static data member ‘XplorSimulation::scriptingIndex_’
xplorSimulation.cc:54:6: error: from this location
/Users/howarth/xplor-nih-2.27/common/xplorSimulation.hh:138:7: error: invalid
use of non-static data member ‘XplorSimulation::scriptingIndex_’
xplorSimulation.cc:56:7: error: from this location

Is this behavior expected or shouldn't this new error be suppressible with the
-fpermissive flag?


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

* [Bug c++/50365] invalid use of non-static data member not suppressed by -fpermissive
  2011-09-12 13:32 [Bug c++/50365] New: invalid use of non-static data member not suppressed by -fpermissive howarth at nitro dot med.uc.edu
@ 2011-09-12 13:47 ` howarth at nitro dot med.uc.edu
  2011-09-12 14:27 ` redi at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: howarth at nitro dot med.uc.edu @ 2011-09-12 13:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jack Howarth <howarth at nitro dot med.uc.edu> 2011-09-12 13:32:16 UTC ---
Bzip2 compressed preprocessed source file for common/xplorSimulation.cc
attached to reproduce the failure with...

[MacPro:~/xplor-nih-2.27/common/bin.Darwin_11_x86_64] howarth% g++-fsf-4.7 -c
xplorSimulation.ii -O3 -ffast-math -funroll-loops -g -fpermissive 
-DX_MMAP_FLAGS=0 -DFORTRAN_INIT -fno-common  -DDARWIN -D_REENTRANT -DNDEBUG
-DCPLUSPLUS -DUSE_CDS_NAMESPACE
xplorSimulation.cc: In constructor ‘XplorSimulation::XplorSimulation(bool)’:
xplorSimulation.cc:53:26: error: cannot call member function ‘XplorVars*
XplorSimulation::xplorVars()’ without object
/Users/howarth/xplor-nih-2.27/common/xplorSimulation.hh:138:7: error: invalid
use of non-static data member ‘XplorSimulation::scriptingIndex_’
xplorSimulation.cc:54:6: error: from this location
/Users/howarth/xplor-nih-2.27/common/xplorSimulation.hh:138:7: error: invalid
use of non-static data member ‘XplorSimulation::scriptingIndex_’
xplorSimulation.cc:56:7: error: from this location


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

* [Bug c++/50365] invalid use of non-static data member not suppressed by -fpermissive
  2011-09-12 13:32 [Bug c++/50365] New: invalid use of non-static data member not suppressed by -fpermissive howarth at nitro dot med.uc.edu
  2011-09-12 13:47 ` [Bug c++/50365] " howarth at nitro dot med.uc.edu
@ 2011-09-12 14:27 ` redi at gcc dot gnu.org
  2011-09-12 14:28 ` [Bug c++/50365] non-static data member error on valid code redi at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2011-09-12 14:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-09-12 13:47:18 UTC ---
-fpermissive is not a catch-all "behave like previous versions" switch, but in
any case, surely the problem here is that the code is valid, it nothing to do
with -fpermissive

scriptingIndex_ is a member of XplorSimulation, and you're in a member function
of that class


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

* [Bug c++/50365] non-static data member error on valid code
  2011-09-12 13:32 [Bug c++/50365] New: invalid use of non-static data member not suppressed by -fpermissive howarth at nitro dot med.uc.edu
  2011-09-12 13:47 ` [Bug c++/50365] " howarth at nitro dot med.uc.edu
  2011-09-12 14:27 ` redi at gcc dot gnu.org
@ 2011-09-12 14:28 ` redi at gcc dot gnu.org
  2011-09-12 14:44 ` [Bug c++/50365] [4.7 Regression] " redi at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2011-09-12 14:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-09-12 14:26:33 UTC ---
reduced

template<class CHAR=char>
class CDSString {

public:
  CDSString(const CHAR* s="",
    int len=-1,
     const int blockSize=8);
  CDSString(const CDSString&);

  bool matches(const CHAR* str,
       bool ignoreCase=0) const;

};

template<class CHAR>
inline bool operator==(const CDSString<CHAR>& s1,const CHAR* s2)
{return s1.matches(s2);}

typedef CDSString<char> String;


struct XplorVars { const char* const aner; };

class XplorSimulation {

public:

  XplorSimulation(bool clone=0);


  XplorVars* xplorVars();

  int scriptingIndex_;

};


XplorSimulation::XplorSimulation(bool clone)
{
   int i = 0;
   if ( String(xplorVars()->aner+i*4,4) == "SCRI" )
     scriptingIndex_ = i;
}


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

* [Bug c++/50365] [4.7 Regression] non-static data member error on valid code
  2011-09-12 13:32 [Bug c++/50365] New: invalid use of non-static data member not suppressed by -fpermissive howarth at nitro dot med.uc.edu
                   ` (2 preceding siblings ...)
  2011-09-12 14:28 ` [Bug c++/50365] non-static data member error on valid code redi at gcc dot gnu.org
@ 2011-09-12 14:44 ` redi at gcc dot gnu.org
  2011-09-12 14:48 ` redi at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2011-09-12 14:44 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011-09-12
            Summary|non-static data member      |[4.7 Regression] non-static
                   |error on valid code         |data member error on valid
                   |                            |code
     Ever Confirmed|0                           |1


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

* [Bug c++/50365] [4.7 Regression] non-static data member error on valid code
  2011-09-12 13:32 [Bug c++/50365] New: invalid use of non-static data member not suppressed by -fpermissive howarth at nitro dot med.uc.edu
                   ` (3 preceding siblings ...)
  2011-09-12 14:44 ` [Bug c++/50365] [4.7 Regression] " redi at gcc dot gnu.org
@ 2011-09-12 14:48 ` redi at gcc dot gnu.org
  2011-09-13 23:09 ` howarth at nitro dot med.uc.edu
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2011-09-12 14:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-09-12 14:44:20 UTC ---
further reduced

struct String {
  String(const char* s, int len);

  bool test();
};

struct XplorVars { const char* aner; };

struct XplorSimulation {
  XplorSimulation();

  XplorVars* xplorVars();
};

XplorSimulation::XplorSimulation()
{
   if ( String(xplorVars()->aner, 4).test() )
     ;
}


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

* [Bug c++/50365] [4.7 Regression] non-static data member error on valid code
  2011-09-12 13:32 [Bug c++/50365] New: invalid use of non-static data member not suppressed by -fpermissive howarth at nitro dot med.uc.edu
                   ` (4 preceding siblings ...)
  2011-09-12 14:48 ` redi at gcc dot gnu.org
@ 2011-09-13 23:09 ` howarth at nitro dot med.uc.edu
  2011-09-13 23:16 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: howarth at nitro dot med.uc.edu @ 2011-09-13 23:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jack Howarth <howarth at nitro dot med.uc.edu> 2011-09-13 22:54:56 UTC ---
Test case from Comment 4 compiles fine at r175670, but fails at r175671 with...

[MacPro:~] howarth% /Users/howarth/dist/bin/g++ -c test.cc
test.cc: In constructor ‘XplorSimulation::XplorSimulation()’:
test.cc:17:27: internal compiler error: in cp_parser_late_return_type_opt, at
cp/parser.c:15558

(PR49691)...

r175671 | jason | 2011-06-29 17:19:31 -0400 (Wed, 29 Jun 2011) | 8 lines

        DR 1207
        PR c++/49003
        * cp-tree.h (struct saved_scope): Add x_current_class_ptr,
        x_current_class_ref.
        (current_class_ptr, current_class_ref): Use them.
        * decl.c (build_this_parm): Handle getting the class type.
        * parser.c (cp_parser_late_return_type_opt): Set up 'this'
        for use within the trailing return type.


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

* [Bug c++/50365] [4.7 Regression] non-static data member error on valid code
  2011-09-12 13:32 [Bug c++/50365] New: invalid use of non-static data member not suppressed by -fpermissive howarth at nitro dot med.uc.edu
                   ` (5 preceding siblings ...)
  2011-09-13 23:09 ` howarth at nitro dot med.uc.edu
@ 2011-09-13 23:16 ` redi at gcc dot gnu.org
  2011-09-13 23:57 ` howarth at nitro dot med.uc.edu
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2011-09-13 23:16 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-09-13 23:08:37 UTC ---
let's ask Jason to take a look then


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

* [Bug c++/50365] [4.7 Regression] non-static data member error on valid code
  2011-09-12 13:32 [Bug c++/50365] New: invalid use of non-static data member not suppressed by -fpermissive howarth at nitro dot med.uc.edu
                   ` (6 preceding siblings ...)
  2011-09-13 23:16 ` redi at gcc dot gnu.org
@ 2011-09-13 23:57 ` howarth at nitro dot med.uc.edu
  2011-09-15 14:15 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: howarth at nitro dot med.uc.edu @ 2011-09-13 23:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Jack Howarth <howarth at nitro dot med.uc.edu> 2011-09-13 23:15:17 UTC ---
At r176120 which fixed PR49691, the test case from Comment 4, begins to fail in
the current mode...

[MacPro:~] howarth% /Users/howarth/dist/bin/g++ -c test.cc
test.cc: In constructor ‘XplorSimulation::XplorSimulation()’:
test.cc:17:26: error: cannot call member function ‘XplorVars*
XplorSimulation::xplorVars()’ without object

r176120 | jason | 2011-07-10 10:24:03 -0400 (Sun, 10 Jul 2011) | 5 lines

        PR c++/49691
        * parser.c (cp_parser_late_return_type_opt): Check quals parameter
        rather than current_class_type to determine whether to set 'this'.
        (cp_parser_direct_declarator): Pass -1 to quals if member_p is false.
        (cp_parser_init_declarator): Pass down member_p.


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

* [Bug c++/50365] [4.7 Regression] non-static data member error on valid code
  2011-09-12 13:32 [Bug c++/50365] New: invalid use of non-static data member not suppressed by -fpermissive howarth at nitro dot med.uc.edu
                   ` (7 preceding siblings ...)
  2011-09-13 23:57 ` howarth at nitro dot med.uc.edu
@ 2011-09-15 14:15 ` jason at gcc dot gnu.org
  2011-09-15 14:35 ` jason at gcc dot gnu.org
  2011-09-15 14:36 ` jason at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2011-09-15 14:15 UTC (permalink / raw)
  To: gcc-bugs

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

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

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


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

* [Bug c++/50365] [4.7 Regression] non-static data member error on valid code
  2011-09-12 13:32 [Bug c++/50365] New: invalid use of non-static data member not suppressed by -fpermissive howarth at nitro dot med.uc.edu
                   ` (8 preceding siblings ...)
  2011-09-15 14:15 ` jason at gcc dot gnu.org
@ 2011-09-15 14:35 ` jason at gcc dot gnu.org
  2011-09-15 14:36 ` jason at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2011-09-15 14:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> 2011-09-15 14:33:42 UTC ---
Author: jason
Date: Thu Sep 15 14:33:37 2011
New Revision: 178883

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=178883
Log:
    PR c++/50365
    * parser.c (cp_parser_late_return_type_opt): Check quals parameter
    for clearing current_class_ptr, too.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/trailing7.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/50365] [4.7 Regression] non-static data member error on valid code
  2011-09-12 13:32 [Bug c++/50365] New: invalid use of non-static data member not suppressed by -fpermissive howarth at nitro dot med.uc.edu
                   ` (9 preceding siblings ...)
  2011-09-15 14:35 ` jason at gcc dot gnu.org
@ 2011-09-15 14:36 ` jason at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2011-09-15 14:36 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> 2011-09-15 14:34:06 UTC ---
Fixed.


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

end of thread, other threads:[~2011-09-15 14:35 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-12 13:32 [Bug c++/50365] New: invalid use of non-static data member not suppressed by -fpermissive howarth at nitro dot med.uc.edu
2011-09-12 13:47 ` [Bug c++/50365] " howarth at nitro dot med.uc.edu
2011-09-12 14:27 ` redi at gcc dot gnu.org
2011-09-12 14:28 ` [Bug c++/50365] non-static data member error on valid code redi at gcc dot gnu.org
2011-09-12 14:44 ` [Bug c++/50365] [4.7 Regression] " redi at gcc dot gnu.org
2011-09-12 14:48 ` redi at gcc dot gnu.org
2011-09-13 23:09 ` howarth at nitro dot med.uc.edu
2011-09-13 23:16 ` redi at gcc dot gnu.org
2011-09-13 23:57 ` howarth at nitro dot med.uc.edu
2011-09-15 14:15 ` jason at gcc dot gnu.org
2011-09-15 14:35 ` jason at gcc dot gnu.org
2011-09-15 14:36 ` 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).