This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/57892] New: g++ internal compiler error: in expand_expr_real_1, at expr.c:9122 while attempting to brace-initialize a dynamically allocated array class member


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

            Bug ID: 57892
           Summary: g++ internal compiler error: in expand_expr_real_1, at
                    expr.c:9122 while attempting to brace-initialize a
                    dynamically allocated array class member
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lmorell at atu dot edu

Tried to see if a class member's array value can be dynamically allocated and
brace initialized.  

The following error message is generated:

error.cc: In copy constructor 'Type::Type(const Type&)':
error.cc:3:26: internal compiler error: in expand_expr_real_1, at expr.c:9122
Please submit a full bug report,
with preprocessed source if appropriate.

Here is the source code:

class Type {
public:
   int *a = new int[10]{0};
   Type () { }
   Type(const Type  & lt) { }
};
int main () {
   Type lt1;
   Type lt2 (lt1);;
}
Removing the {0} eliminates the error.  Don't know whether or not the source is
syntactically correct, but it certainly should not be giving an internal
compiler error.

g++ --version gives:
g++ (SUSE Linux) 4.7.1 20120723 [gcc-4_7-branch revision 189773].

This is on OpenSuse 12.3, if that is relevant.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]