public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/59435] New: sizeof...(T) as default value for an argument does not work
@ 2013-12-09 16:33 thomas.sanchz at gmail dot com
  2013-12-09 19:21 ` [Bug c++/59435] sizeof...(T) as default value for an argument in the constructor " paolo.carlini at oracle dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: thomas.sanchz at gmail dot com @ 2013-12-09 16:33 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 59435
           Summary: sizeof...(T) as default value for an argument does not
                    work
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: thomas.sanchz at gmail dot com

Hi everybody,

I encountered something not supported in gcc from 4.7 to 4.9, but working in
clang from 3.2 (tested on gcc goldbot).

Here is the code:

template <typename... E>
struct T
{
  T(unsigned int i = sizeof...(E)){} // does not compile

  static constexpr unsigned int U = sizeof...(E);
  T(unsigned int j, unsigned int i = U){} //  compile
};

template <typename... T>
void test(int i = sizeof...(T)) // compile
{}

Invocation with "g++ -std=c++11 test.cpp" is enough to reproduce the bug.

Please let me know if you need more information.

Cheers,


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

* [Bug c++/59435] sizeof...(T) as default value for an argument in the constructor does not work
  2013-12-09 16:33 [Bug c++/59435] New: sizeof...(T) as default value for an argument does not work thomas.sanchz at gmail dot com
@ 2013-12-09 19:21 ` paolo.carlini at oracle dot com
  2013-12-09 22:59 ` paolo at gcc dot gnu.org
  2013-12-09 23:00 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-12-09 19:21 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2013-12-09
           Assignee|unassigned at gcc dot gnu.org      |paolo.carlini at oracle dot com
   Target Milestone|---                         |4.9.0
     Ever confirmed|0                           |1

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
The problem is in cp_parser_cache_defarg as called by
cp_parser_parameter_declaration


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

* [Bug c++/59435] sizeof...(T) as default value for an argument in the constructor does not work
  2013-12-09 16:33 [Bug c++/59435] New: sizeof...(T) as default value for an argument does not work thomas.sanchz at gmail dot com
  2013-12-09 19:21 ` [Bug c++/59435] sizeof...(T) as default value for an argument in the constructor " paolo.carlini at oracle dot com
@ 2013-12-09 22:59 ` paolo at gcc dot gnu.org
  2013-12-09 23:00 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: paolo at gcc dot gnu.org @ 2013-12-09 22:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Mon Dec  9 22:59:33 2013
New Revision: 205836

URL: http://gcc.gnu.org/viewcvs?rev=205836&root=gcc&view=rev
Log:
/cp
2013-12-09  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/59435
    * parser.c (cp_parser_cache_defarg): sizeof ... ( p ) can
    occur in a default argument too.

/testsuite
2013-12-09  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/59435
    * g++.dg/cpp0x/variadic-sizeof3.C: New.

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


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

* [Bug c++/59435] sizeof...(T) as default value for an argument in the constructor does not work
  2013-12-09 16:33 [Bug c++/59435] New: sizeof...(T) as default value for an argument does not work thomas.sanchz at gmail dot com
  2013-12-09 19:21 ` [Bug c++/59435] sizeof...(T) as default value for an argument in the constructor " paolo.carlini at oracle dot com
  2013-12-09 22:59 ` paolo at gcc dot gnu.org
@ 2013-12-09 23:00 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-12-09 23:00 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
           Assignee|paolo.carlini at oracle dot com    |unassigned at gcc dot gnu.org

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Fixed for 4.9.0.


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

end of thread, other threads:[~2013-12-09 23:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-09 16:33 [Bug c++/59435] New: sizeof...(T) as default value for an argument does not work thomas.sanchz at gmail dot com
2013-12-09 19:21 ` [Bug c++/59435] sizeof...(T) as default value for an argument in the constructor " paolo.carlini at oracle dot com
2013-12-09 22:59 ` paolo at gcc dot gnu.org
2013-12-09 23:00 ` 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).