The declaration form proj (space(V[i]), V_new_i, "mass"); of an object 'proj' of class 'form' is not recognized, see below
#include <vector> using std::vector; #include <string> struct space_component; struct const_space_component; template <class T> class smart_pointer { public: // allocators: smart_pointer (T* p = 0); smart_pointer (const smart_pointer&); ~smart_pointer (); smart_pointer& operator= (const smart_pointer&); // accessors: const T* pointer () const; const T& data () const; const T* operator-> () const; const T& operator* () const; // modifiers: T* pointer (); T* operator-> (); T& data (); T& operator* (); // implementation: }; typedef int basis; class spacerep { public: typedef std::vector<basis>::size_type size_type; spacerep(); }; class space : public smart_pointer<spacerep> { public: // typdefs: typedef spacerep::size_type size_type; // allocator/deallocator: space (); space(const const_space_component&); space_component operator [] (size_type i_comp); const_space_component operator [] (size_type i_comp) const; }; struct space_component { typedef space::size_type size_type; space_component(); space_component(space& V, size_type i); }; struct const_space_component { typedef space::size_type size_type; const_space_component(); const_space_component(const space_component&); }; class form { public : form (); form (const space& X, const space& Y, const std::string& op_name, bool locked_boundaries=false); }; int main() { space V, V_new_i; int i=1; form proj (space(V[i]), V_new_i, "mass"); /* error: parameter may not have variably modified type 'space [(((long unsigned int)(((long int)i) + -0x00000000000000001)) + 1)]' */ } -- Summary: misparsing an object declaration - parameter may not have variably modified type Product: gcc Version: 4.4.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jarausch at igpm dot rwth-aachen dot de GCC build triplet: x86-64 GCC host triplet: x86-64 GCC target triplet: x86-64 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41786