public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/57769] New: Unable to call a constructor invoking another constructor in the same class (sister constructor) with designated initializer for aggregate types
@ 2013-07-01  9:01 korpela.henri.mikael at gmail dot com
  2013-07-01  9:05 ` [Bug c++/57769] " korpela.henri.mikael at gmail dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: korpela.henri.mikael at gmail dot com @ 2013-07-01  9:01 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 57769
           Summary: Unable to call a constructor invoking another
                    constructor in the same class (sister constructor)
                    with designated initializer for aggregate types
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: blocker
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: korpela.henri.mikael at gmail dot com

While implementing a matrix class template called Matrix4, I ran into a problem
with designated initializers for aggregate types. Here is my Matrix4 class
implementation (shortened):

http://pastebin.com/t5ESv24K

Calling a constructor Matrix4<T>::Matrix4(T (&)[4][4]) or Matrix4<T>::Matrix4(T
(&&)[4][4]), both of which invoke sister constructor called
Matrix4<T>::Matrix4(Matrix4&&) with designated initializer for aggregate types
(<i>lines 40-47 and 52-59</i>), leads to internal compiler error, which is as
follows:

<quote>|internal compiler error: in process_init_constructor_array, at
cp/typeck2.c:1080|</quote>


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

* [Bug c++/57769] Unable to call a constructor invoking another constructor in the same class (sister constructor) with designated initializer for aggregate types
  2013-07-01  9:01 [Bug c++/57769] New: Unable to call a constructor invoking another constructor in the same class (sister constructor) with designated initializer for aggregate types korpela.henri.mikael at gmail dot com
@ 2013-07-01  9:05 ` korpela.henri.mikael at gmail dot com
  2013-07-01  9:11 ` paolo.carlini at oracle dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: korpela.henri.mikael at gmail dot com @ 2013-07-01  9:05 UTC (permalink / raw)
  To: gcc-bugs

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

Henri <korpela.henri.mikael at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|blocker                     |normal


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

* [Bug c++/57769] Unable to call a constructor invoking another constructor in the same class (sister constructor) with designated initializer for aggregate types
  2013-07-01  9:01 [Bug c++/57769] New: Unable to call a constructor invoking another constructor in the same class (sister constructor) with designated initializer for aggregate types korpela.henri.mikael at gmail dot com
  2013-07-01  9:05 ` [Bug c++/57769] " korpela.henri.mikael at gmail dot com
@ 2013-07-01  9:11 ` paolo.carlini at oracle dot com
  2013-07-01  9:58 ` korpela.henri.mikael at gmail dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-07-01  9:11 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2013-07-01
     Ever confirmed|0                           |1

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Please add here a minimized self-contained reproducer. Also, you are not saying
which version of GCC you are using.


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

* [Bug c++/57769] Unable to call a constructor invoking another constructor in the same class (sister constructor) with designated initializer for aggregate types
  2013-07-01  9:01 [Bug c++/57769] New: Unable to call a constructor invoking another constructor in the same class (sister constructor) with designated initializer for aggregate types korpela.henri.mikael at gmail dot com
  2013-07-01  9:05 ` [Bug c++/57769] " korpela.henri.mikael at gmail dot com
  2013-07-01  9:11 ` paolo.carlini at oracle dot com
@ 2013-07-01  9:58 ` korpela.henri.mikael at gmail dot com
  2013-07-01 10:56 ` paolo.carlini at oracle dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: korpela.henri.mikael at gmail dot com @ 2013-07-01  9:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Henri <korpela.henri.mikael at gmail dot com> ---
(In reply to Paolo Carlini from comment #1)
> Please add here a minimized self-contained reproducer. Also, you are not
> saying which version of GCC you are using.

My GCC version is currently 4.7. I use Code::Blocks as my IDE.

Interesting that my attempt to reproduce the internal compiler error fails in
the self-contained code below (with compiler errors)...

class C{
public:

    C(C&&) = default;

    explicit C(int (&array)[2][2]) : C({
        ._m_array = {
            {array[0][0], array[0][1]},
            {array[1][0], array[1][1]}
        }
    })
    {

    }

private:
    int _m_array[2][2];
};

int main(void){
    int array[2][2] = {
        {1, 2},
        {3, 4}
    };
    C c(array);
    return 0;
}

||In constructor 'C::C(int (&)[2][2])':|
|42|error: no matching function for call to 'C::C(<brace-enclosed initializer
list>)'|
|42|note: candidates are:|
|37|note: C::C(int (&)[2][2])|
|37|note:   no known conversion for argument 1 from '<brace-enclosed
initializer list>' to 'int (&)[2][2]'|
|35|note: constexpr C::C(C&&)|
|35|note:   no known conversion for argument 1 from '<brace-enclosed
initializer list>' to 'C&&'|
||=== Build finished: 1 errors, 0 warnings (0 minutes, 0 seconds) ===|

...and somehow succeeds here:

class C{
public:

    C(C&&) = default;

    explicit C(int (&&array)[2][2]) : C({
        ._m_array = {
            {array[0][0], array[0][1]},
            {array[1][0], array[1][1]}
        }
    })
    {

    }

private:
    int _m_array[2][2];
};

int main(void){
    C c({{
        {1, 2},
        {3, 4}
    }});
    return 0;
}

||In constructor 'C::C(int (&&)[2][2])':|
|42|internal compiler error: in process_init_constructor_array, at
cp/typeck2.c:1080|
||=== Build finished: 1 errors, 0 warnings (0 minutes, 0 seconds) ===|

This leads me to believe that the compiler fails to parse rvalue references to
multidimensional arrays in a scenario like this.


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

* [Bug c++/57769] Unable to call a constructor invoking another constructor in the same class (sister constructor) with designated initializer for aggregate types
  2013-07-01  9:01 [Bug c++/57769] New: Unable to call a constructor invoking another constructor in the same class (sister constructor) with designated initializer for aggregate types korpela.henri.mikael at gmail dot com
                   ` (2 preceding siblings ...)
  2013-07-01  9:58 ` korpela.henri.mikael at gmail dot com
@ 2013-07-01 10:56 ` paolo.carlini at oracle dot com
  2013-07-01 11:00 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-07-01 10:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Both examples are rejected with no ICE by current mainline and 4_8-branch. The
same happens with current ICC and rather recent clang.


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

* [Bug c++/57769] Unable to call a constructor invoking another constructor in the same class (sister constructor) with designated initializer for aggregate types
  2013-07-01  9:01 [Bug c++/57769] New: Unable to call a constructor invoking another constructor in the same class (sister constructor) with designated initializer for aggregate types korpela.henri.mikael at gmail dot com
                   ` (3 preceding siblings ...)
  2013-07-01 10:56 ` paolo.carlini at oracle dot com
@ 2013-07-01 11:00 ` paolo.carlini at oracle dot com
  2013-07-01 11:17 ` korpela.henri.mikael at gmail dot com
  2013-10-17 11:17 ` paolo.carlini at oracle dot com
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-07-01 11:00 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |UNCONFIRMED
     Ever confirmed|1                           |0


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

* [Bug c++/57769] Unable to call a constructor invoking another constructor in the same class (sister constructor) with designated initializer for aggregate types
  2013-07-01  9:01 [Bug c++/57769] New: Unable to call a constructor invoking another constructor in the same class (sister constructor) with designated initializer for aggregate types korpela.henri.mikael at gmail dot com
                   ` (4 preceding siblings ...)
  2013-07-01 11:00 ` paolo.carlini at oracle dot com
@ 2013-07-01 11:17 ` korpela.henri.mikael at gmail dot com
  2013-10-17 11:17 ` paolo.carlini at oracle dot com
  6 siblings, 0 replies; 8+ messages in thread
From: korpela.henri.mikael at gmail dot com @ 2013-07-01 11:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Henri <korpela.henri.mikael at gmail dot com> ---
(In reply to Paolo Carlini from comment #3)
> Both examples are rejected with no ICE by current mainline and 4_8-branch.
> The same happens with current ICC and rather recent clang.

So, this is not a bug, right?


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

* [Bug c++/57769] Unable to call a constructor invoking another constructor in the same class (sister constructor) with designated initializer for aggregate types
  2013-07-01  9:01 [Bug c++/57769] New: Unable to call a constructor invoking another constructor in the same class (sister constructor) with designated initializer for aggregate types korpela.henri.mikael at gmail dot com
                   ` (5 preceding siblings ...)
  2013-07-01 11:17 ` korpela.henri.mikael at gmail dot com
@ 2013-10-17 11:17 ` paolo.carlini at oracle dot com
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-10-17 11:17 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Closing.


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

end of thread, other threads:[~2013-10-17 11:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-01  9:01 [Bug c++/57769] New: Unable to call a constructor invoking another constructor in the same class (sister constructor) with designated initializer for aggregate types korpela.henri.mikael at gmail dot com
2013-07-01  9:05 ` [Bug c++/57769] " korpela.henri.mikael at gmail dot com
2013-07-01  9:11 ` paolo.carlini at oracle dot com
2013-07-01  9:58 ` korpela.henri.mikael at gmail dot com
2013-07-01 10:56 ` paolo.carlini at oracle dot com
2013-07-01 11:00 ` paolo.carlini at oracle dot com
2013-07-01 11:17 ` korpela.henri.mikael at gmail dot com
2013-10-17 11:17 ` paolo.carlini at oracle 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).