public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/16879] New: variable declaration not allowed
@ 2004-08-04 18:32 bhorner at wernervas dot com
  0 siblings, 0 replies; only message in thread
From: bhorner at wernervas dot com @ 2004-08-04 18:32 UTC (permalink / raw)
  To: gcc-bugs

I'm the following version of gcc (as reported by gcc_select)
gcc version 3.3 20030304 (Apple Computer, Inc. build 1495)

My system is (as reported by "About This Mac"):
Model:
PowerBook G4 17"
Operating system:
Mac OS X Version 10.3.4
Processor:
1 GHz PowerPC G4
1 MB L3 cache
Memory:
1 GB DDR SDRAM

gcc was configured / built / installed by the Mac developer tools install program.

the command line that triggers the bug is:
g++ main.cpp

compiler output (from g++ -v -save-temps main.cpp):
Reading specs from /usr/libexec/gcc/darwin/ppc/3.3/specs
Thread model: posix
gcc version 3.3 20030304 (Apple Computer, Inc. build 1495)
 /usr/libexec/gcc/darwin/ppc/3.3/cc1plus -E -D__GNUG__=3 -quiet -v -D__GNUC__=3 
-D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=0 -D__APPLE_CC__=1495 -D__DYNAMIC__ 
main.cpp -fPIC -D__private_extern__=extern main.ii
ignoring nonexistent directory "/usr/ppc-darwin/include"
ignoring nonexistent directory "/Local/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/gcc/darwin/3.3/c++
 /usr/include/gcc/darwin/3.3/c++/ppc-darwin
 /usr/include/gcc/darwin/3.3/c++/backward
 /usr/local/include
 /usr/include/gcc/darwin/3.3
 /usr/include
End of search list.
Framework search starts here:
 /System/Library/Frameworks
 /Library/Frameworks
End of framework search list.
 /usr/libexec/gcc/darwin/ppc/3.3/cc1plus -fpreprocessed main.ii -fPIC -quiet -dumpbase main.cpp 
-auxbase main -version -D__private_extern__=extern -o main.s
GNU C++ version 3.3 20030304 (Apple Computer, Inc. build 1495) (ppc-darwin)
        compiled by GNU C version 3.3 20030304 (Apple Computer, Inc. build 1495).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=131072
main.cpp: In function `int main()':
main.cpp:28: error: variable declaration is not allowed here

my actual source code (which contains no includes or anything, but does contain examples):
template <typename T>
class ParameterMember{
        private:
                T m_T_inst;
        public:
                ParameterMember(const T& T_inst): m_T_inst(T_inst){}
};
typedef ParameterMember<int> PrimitiveMember;
typedef ParameterMember<PrimitiveMember> InstanceMember;

int main(){
//----------------------------------------------------------------------------
        // this doesn't compile; "error: variable declaration is not allowed here"
        ParameterMember<InstanceMember> x(InstanceMember(PrimitiveMember(10)));
//----------------------------------------------------------------------------
        // why is variable declaration not allowed above?
//----------------------------------------------------------------------------
        // this compiles
        // ParameterMember<IntstanceMember> is constructed as a temporary
//      ParameterMember<InstanceMember>(InstanceMember(PrimitiveMember(10)));
//----------------------------------------------------------------------------
        // this compiles
        // default assignment of temporary to declared variable... (initialization?)
//      ParameterMember<InstanceMember> x = 
ParameterMember<InstanceMember>(InstanceMember(PrimitiveMember(10)));
//----------------------------------------------------------------------------
        // this compiles
        // ParameterMember<InstanceMember> is constructed from a temporary InstanceMember
//      PrimitiveMember prm(10);
//      ParameterMember<InstanceMember> pm1(InstanceMember(prm));
//----------------------------------------------------------------------------
        // this compiles
        // IntanceMember is constructed from a temporary PrimitiveMember
//      InstanceMember im(PrimitiveMember(10));
//      ParameterMember<InstanceMember> pm2(im);
//----------------------------------------------------------------------------
}

-- 
           Summary: variable declaration not allowed
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bhorner at wernervas dot com
                CC: gcc-bugs at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-08-04 18:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-04 18:32 [Bug c++/16879] New: variable declaration not allowed bhorner at wernervas 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).