public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/55232] New: [C++0x] Compilation fails if expanding function param pack in initializer_list
@ 2012-11-07 13:37 breakpoint at f5soft dot com
  2012-11-07 13:46 ` [Bug c++/55232] " paolo.carlini at oracle dot com
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: breakpoint at f5soft dot com @ 2012-11-07 13:37 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55232
           Summary: [C++0x] Compilation fails if expanding function param
                    pack in initializer_list
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: breakpoint@f5soft.com


Compilation of following source code gives error message:

"Compiling: main.cpp
'
in dependent_type_p, at cp/pt.c:19321"

Source code:

#include <vector>
#include <list>

using namespace std;

template< class... T >
struct X : T...
{
    void push_back( typename T::value_type ... vals )
    {
        initializer_list<int> li = { (T::push_back(vals), 1)... };  //Fail
    }
};

int main()
{
    X< vector<double>, list<int> > x;
    x.push_back(1.1, 2);
    return 0;
}


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

* [Bug c++/55232] [C++0x] Compilation fails if expanding function param pack in initializer_list
  2012-11-07 13:37 [Bug c++/55232] New: [C++0x] Compilation fails if expanding function param pack in initializer_list breakpoint at f5soft dot com
@ 2012-11-07 13:46 ` paolo.carlini at oracle dot com
  2012-11-07 13:52 ` [Bug c++/55232] [C++11] " redi at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-11-07 13:46 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
      Known to work|                            |4.7.2, 4.8.0
         Resolution|                            |WORKSFORME

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-11-07 13:45:57 UTC ---
I can't reproduce this, not even on stock 4.7.0 or current 4_5-branch and
4_6-branch.


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

* [Bug c++/55232] [C++11] Compilation fails if expanding function param pack in initializer_list
  2012-11-07 13:37 [Bug c++/55232] New: [C++0x] Compilation fails if expanding function param pack in initializer_list breakpoint at f5soft dot com
  2012-11-07 13:46 ` [Bug c++/55232] " paolo.carlini at oracle dot com
@ 2012-11-07 13:52 ` redi at gcc dot gnu.org
  2012-11-07 13:54 ` redi at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2012-11-07 13:52 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
             Status|RESOLVED                    |NEW
   Last reconfirmed|                            |2012-11-07
      Known to work|4.7.2, 4.8.0                |
         Resolution|WORKSFORME                  |
            Summary|[C++0x] Compilation fails   |[C++11] Compilation fails
                   |if expanding function param |if expanding function param
                   |pack in initializer_list    |pack in initializer_list
     Ever Confirmed|0                           |1

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-11-07 13:52:34 UTC ---
It only fails with warnings enabled.

Reduced:

struct vector
{
    typedef double value_type;

    int push_back() { return 0; }
};

template< class... T >
struct X : T...
{
    void push_back( typename T::value_type ... vals )
    {
        int li[] = { T::push_back()... };  //Fail
    }
};

int main()
{
    X< vector > x;
    x.push_back(2);
    return 0;
}


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

* [Bug c++/55232] [C++11] Compilation fails if expanding function param pack in initializer_list
  2012-11-07 13:37 [Bug c++/55232] New: [C++0x] Compilation fails if expanding function param pack in initializer_list breakpoint at f5soft dot com
  2012-11-07 13:46 ` [Bug c++/55232] " paolo.carlini at oracle dot com
  2012-11-07 13:52 ` [Bug c++/55232] [C++11] " redi at gcc dot gnu.org
@ 2012-11-07 13:54 ` redi at gcc dot gnu.org
  2012-11-07 14:00 ` paolo.carlini at oracle dot com
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2012-11-07 13:54 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic, ice-checking
      Known to fail|                            |4.8.0

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-11-07 13:54:43 UTC ---
ICE caused by -Wunused with --enable-checking


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

* [Bug c++/55232] [C++11] Compilation fails if expanding function param pack in initializer_list
  2012-11-07 13:37 [Bug c++/55232] New: [C++0x] Compilation fails if expanding function param pack in initializer_list breakpoint at f5soft dot com
                   ` (2 preceding siblings ...)
  2012-11-07 13:54 ` redi at gcc dot gnu.org
@ 2012-11-07 14:00 ` paolo.carlini at oracle dot com
  2012-11-07 14:03 ` redi at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-11-07 14:00 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-11-07 14:00:12 UTC ---
Actually is the -Wunused alone which makes the difference, not the
--enable-checking. Weird, must be due to diagnostics reentered. Weird.


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

* [Bug c++/55232] [C++11] Compilation fails if expanding function param pack in initializer_list
  2012-11-07 13:37 [Bug c++/55232] New: [C++0x] Compilation fails if expanding function param pack in initializer_list breakpoint at f5soft dot com
                   ` (3 preceding siblings ...)
  2012-11-07 14:00 ` paolo.carlini at oracle dot com
@ 2012-11-07 14:03 ` redi at gcc dot gnu.org
  2012-11-07 14:08 ` [Bug c++/55232] [C++11] ICE with -Wunused-parameter for unused parameter pack using qualified dependent name redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2012-11-07 14:03 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-11-07 14:03:40 UTC ---
Specifically, -Wunused-parameter

struct vector
{
    typedef int value_type;
};

template< class... T >
struct X
{
    void push_back( typename T::value_type ... vals )
    {
    }
};

int main()
{
    X< vector > x;
    x.push_back( 0 );
}


'
in dependent_type_p, at cp/pt.c:19250
     }
     ^
0x56ee10 dependent_type_p
        ../../gcc-4.8-20121104/gcc/cp/pt.c:19250
0x56f744 dependent_scope_p(tree_node*)
        ../../gcc-4.8-20121104/gcc/cp/pt.c:19281
0x5391f9 make_typename_type(tree_node*, tree_node*, tag_types, int)
        ../../gcc-4.8-20121104/gcc/cp/decl.c:3273
0x5948f9 tsubst
        ../../gcc-4.8-20121104/gcc/cp/pt.c:11546
0x5948f9 tsubst
        ../../gcc-4.8-20121104/gcc/cp/pt.c:10950
0x60360c dump_template_bindings
        ../../gcc-4.8-20121104/gcc/cp/error.c:325
0x5fc5ff dump_function_decl
        ../../gcc-4.8-20121104/gcc/cp/error.c:1441
0x605e9c decl_to_string
        ../../gcc-4.8-20121104/gcc/cp/error.c:2688
0x605e9c cp_printer
        ../../gcc-4.8-20121104/gcc/cp/error.c:3278
0x605e9c cp_printer
        ../../gcc-4.8-20121104/gcc/cp/error.c:3245
0xf2f5c8 pp_base_format(pretty_print_info*, text_info*)
        ../../gcc-4.8-20121104/gcc/pretty-print.c:509
0xf3059f pp_base_format_verbatim(pretty_print_info*, text_info*)
        ../../gcc-4.8-20121104/gcc/pretty-print.c:565
0xf30687 pp_verbatim(pretty_print_info*, char const*, ...)
        ../../gcc-4.8-20121104/gcc/pretty-print.c:749
0x5f82a1 print_instantiation_full_context
        ../../gcc-4.8-20121104/gcc/cp/error.c:3053
0x5f82a1 maybe_print_instantiation_context
        ../../gcc-4.8-20121104/gcc/cp/error.c:3193
0x5f82a1 maybe_print_instantiation_context
        ../../gcc-4.8-20121104/gcc/cp/error.c:3187
0x6047c5 cp_diagnostic_starter
        ../../gcc-4.8-20121104/gcc/cp/error.c:2881
0xf2cfc8 diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*)
        ../../gcc-4.8-20121104/gcc/diagnostic.c:757
0xf2e3e5 warning(int, char const*, ...)
        ../../gcc-4.8-20121104/gcc/diagnostic.c:918
0x8e7864 do_warn_unused_parameter(tree_node*)
        ../../gcc-4.8-20121104/gcc/function.c:4965
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.


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

* [Bug c++/55232] [C++11] ICE with -Wunused-parameter for unused parameter pack using qualified dependent name
  2012-11-07 13:37 [Bug c++/55232] New: [C++0x] Compilation fails if expanding function param pack in initializer_list breakpoint at f5soft dot com
                   ` (4 preceding siblings ...)
  2012-11-07 14:03 ` redi at gcc dot gnu.org
@ 2012-11-07 14:08 ` redi at gcc dot gnu.org
  2012-11-07 14:08 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2012-11-07 14:08 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|ice-checking                |
      Known to work|                            |4.7.3
            Summary|[C++11] Compilation fails   |[C++11] ICE with
                   |if expanding function param |-Wunused-parameter for
                   |pack in initializer_list    |unused parameter pack using
                   |with -Wunused               |qualified dependent name
      Known to fail|                            |4.5.2, 4.6.3, 4.7.1

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-11-07 14:07:56 UTC ---
It isn't related to initializer lists, see my last reduction, summary adjusted

4.7.3 seems to work, which is why I thought it depended on --enable-checking
(my 4.7. has checking disabled)


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

* [Bug c++/55232] [C++11] ICE with -Wunused-parameter for unused parameter pack using qualified dependent name
  2012-11-07 13:37 [Bug c++/55232] New: [C++0x] Compilation fails if expanding function param pack in initializer_list breakpoint at f5soft dot com
                   ` (5 preceding siblings ...)
  2012-11-07 14:08 ` [Bug c++/55232] [C++11] ICE with -Wunused-parameter for unused parameter pack using qualified dependent name redi at gcc dot gnu.org
@ 2012-11-07 14:08 ` redi at gcc dot gnu.org
  2012-11-07 14:21 ` paolo.carlini at oracle dot com
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2012-11-07 14:08 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-11-07 14:08:42 UTC ---
4.7.3 gives:

t.cc: In instantiation of 'void X<T>::push_back(typename T::value_type ...)
[with T = {vector}; typename T::value_type = <type error>]':
t.cc:17:20:   required from here
t.cc:9:10: warning: unused parameter 'vals#0' [-Wunused-parameter]


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

* [Bug c++/55232] [C++11] ICE with -Wunused-parameter for unused parameter pack using qualified dependent name
  2012-11-07 13:37 [Bug c++/55232] New: [C++0x] Compilation fails if expanding function param pack in initializer_list breakpoint at f5soft dot com
                   ` (6 preceding siblings ...)
  2012-11-07 14:08 ` redi at gcc dot gnu.org
@ 2012-11-07 14:21 ` paolo.carlini at oracle dot com
  2013-02-14 14:03 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-11-07 14:21 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|4.7.3                       |

--- Comment #8 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-11-07 14:20:48 UTC ---
Current 4_7-branch also ICEs.


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

* [Bug c++/55232] [C++11] ICE with -Wunused-parameter for unused parameter pack using qualified dependent name
  2012-11-07 13:37 [Bug c++/55232] New: [C++0x] Compilation fails if expanding function param pack in initializer_list breakpoint at f5soft dot com
                   ` (7 preceding siblings ...)
  2012-11-07 14:21 ` paolo.carlini at oracle dot com
@ 2013-02-14 14:03 ` jason at gcc dot gnu.org
  2013-02-15  1:26 ` jason at gcc dot gnu.org
  2013-02-15 11:20 ` paolo.carlini at oracle dot com
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2013-02-14 14:03 UTC (permalink / raw)
  To: gcc-bugs


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

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

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

--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> 2013-02-14 14:03:11 UTC ---
This test crashes with no warning flags; the crash happens when trying to print
the diagnostic context.

struct vector
{
    typedef int value_type;
};

template< class U, class... T >
struct X
{
    void push_back( typename T::value_type ... vals )
    {
      U::asoeuth;
    }
};

int main()
{   
  X< int, vector > x;
  x.push_back( 0 );
}


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

* [Bug c++/55232] [C++11] ICE with -Wunused-parameter for unused parameter pack using qualified dependent name
  2012-11-07 13:37 [Bug c++/55232] New: [C++0x] Compilation fails if expanding function param pack in initializer_list breakpoint at f5soft dot com
                   ` (8 preceding siblings ...)
  2013-02-14 14:03 ` jason at gcc dot gnu.org
@ 2013-02-15  1:26 ` jason at gcc dot gnu.org
  2013-02-15 11:20 ` paolo.carlini at oracle dot com
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2013-02-15  1:26 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #10 from Jason Merrill <jason at gcc dot gnu.org> 2013-02-15 01:26:39 UTC ---
Author: jason
Date: Fri Feb 15 01:26:34 2013
New Revision: 196064

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=196064
Log:
    PR c++/55232
    * error.c (find_typenames_r): Don't walk into a pack expansion.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/variadic-diag1.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/error.c


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

* [Bug c++/55232] [C++11] ICE with -Wunused-parameter for unused parameter pack using qualified dependent name
  2012-11-07 13:37 [Bug c++/55232] New: [C++0x] Compilation fails if expanding function param pack in initializer_list breakpoint at f5soft dot com
                   ` (9 preceding siblings ...)
  2013-02-15  1:26 ` jason at gcc dot gnu.org
@ 2013-02-15 11:20 ` paolo.carlini at oracle dot com
  10 siblings, 0 replies; 12+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-02-15 11:20 UTC (permalink / raw)
  To: gcc-bugs


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

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

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

--- Comment #11 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-02-15 11:20:09 UTC ---
Fixed.


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

end of thread, other threads:[~2013-02-15 11:20 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-07 13:37 [Bug c++/55232] New: [C++0x] Compilation fails if expanding function param pack in initializer_list breakpoint at f5soft dot com
2012-11-07 13:46 ` [Bug c++/55232] " paolo.carlini at oracle dot com
2012-11-07 13:52 ` [Bug c++/55232] [C++11] " redi at gcc dot gnu.org
2012-11-07 13:54 ` redi at gcc dot gnu.org
2012-11-07 14:00 ` paolo.carlini at oracle dot com
2012-11-07 14:03 ` redi at gcc dot gnu.org
2012-11-07 14:08 ` [Bug c++/55232] [C++11] ICE with -Wunused-parameter for unused parameter pack using qualified dependent name redi at gcc dot gnu.org
2012-11-07 14:08 ` redi at gcc dot gnu.org
2012-11-07 14:21 ` paolo.carlini at oracle dot com
2013-02-14 14:03 ` jason at gcc dot gnu.org
2013-02-15  1:26 ` jason at gcc dot gnu.org
2013-02-15 11:20 ` 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).