public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/53624] New: GCC rejects function local types in template function with default template arguments
@ 2012-06-10  3:38 lunow at math dot hu-berlin.de
  2012-06-10  4:24 ` [Bug c++/53624] " pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: lunow at math dot hu-berlin.de @ 2012-06-10  3:38 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 53624
           Summary: GCC rejects function local types in template function
                    with default template arguments
    Classification: Unclassified
           Product: gcc
           Version: 4.6.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: lunow@math.hu-berlin.de


Created attachment 27595
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27595
testcase

The error occurs when there is at one template argument with default and one
without. Errors are generated for local structs, classes, unions and lambda
functions.
For the attached usecase I get with gcc 4.6.3 and 4.7.0:
C:\dev\projects\compiler test>g++ gcc_test2.cpp --std=c++0x -fsyntax-only
gcc_test2.cpp: In function 'void Foo(T)':
gcc_test2.cpp:5:12: error: no default argument for 'T'


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

* [Bug c++/53624] GCC rejects function local types in template function with default template arguments
  2012-06-10  3:38 [Bug c++/53624] New: GCC rejects function local types in template function with default template arguments lunow at math dot hu-berlin.de
@ 2012-06-10  4:24 ` pinskia at gcc dot gnu.org
  2012-06-10  4:49 ` lunow at math dot hu-berlin.de
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-06-10  4:24 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-06-10 04:24:44 UTC ---
>gcc_test2.cpp:5:12: error: no default argument for 'T'

It is not rejecting the local type but rather it is rejecting the second
template argument which does not have a default argument even though the first
argument does.


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

* [Bug c++/53624] GCC rejects function local types in template function with default template arguments
  2012-06-10  3:38 [Bug c++/53624] New: GCC rejects function local types in template function with default template arguments lunow at math dot hu-berlin.de
  2012-06-10  4:24 ` [Bug c++/53624] " pinskia at gcc dot gnu.org
@ 2012-06-10  4:49 ` lunow at math dot hu-berlin.de
  2012-06-10  4:52 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: lunow at math dot hu-berlin.de @ 2012-06-10  4:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Daniel Lunow <lunow at math dot hu-berlin.de> 2012-06-10 04:49:29 UTC ---
Their is no requirement (in the c++11 standard) for function templates that
implies subsequent template parameters after a template parameter with default
template argument must also have default template arguments (in contrast to
class templates). In general this works in gcc.
But with the local types inside the template function gcc might reject it
because it creates local types as templated with the same template
parameters/default arguments and checks the requirement for class templates.

The line number/offset in the error message clearly refers to the local struct.


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

* [Bug c++/53624] GCC rejects function local types in template function with default template arguments
  2012-06-10  3:38 [Bug c++/53624] New: GCC rejects function local types in template function with default template arguments lunow at math dot hu-berlin.de
  2012-06-10  4:24 ` [Bug c++/53624] " pinskia at gcc dot gnu.org
  2012-06-10  4:49 ` lunow at math dot hu-berlin.de
@ 2012-06-10  4:52 ` pinskia at gcc dot gnu.org
  2012-07-28 13:18 ` paolo.carlini at oracle dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-06-10  4:52 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-06-10 04:52:21 UTC ---
Oh I see.
The trunk shows what is going on better:
t.cc: In function ‘void Foo(T)’:
t.cc:4:12: error: no default argument for ‘T’
   struct X {};
            ^


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

* [Bug c++/53624] GCC rejects function local types in template function with default template arguments
  2012-06-10  3:38 [Bug c++/53624] New: GCC rejects function local types in template function with default template arguments lunow at math dot hu-berlin.de
                   ` (2 preceding siblings ...)
  2012-06-10  4:52 ` pinskia at gcc dot gnu.org
@ 2012-07-28 13:18 ` paolo.carlini at oracle dot com
  2012-07-28 13:20 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-07-28 13:18 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |likan_999.student at sina
                   |                            |dot com

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-07-28 13:17:35 UTC ---
*** Bug 54104 has been marked as a duplicate of this bug. ***


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

* [Bug c++/53624] GCC rejects function local types in template function with default template arguments
  2012-06-10  3:38 [Bug c++/53624] New: GCC rejects function local types in template function with default template arguments lunow at math dot hu-berlin.de
                   ` (3 preceding siblings ...)
  2012-07-28 13:18 ` paolo.carlini at oracle dot com
@ 2012-07-28 13:20 ` paolo.carlini at oracle dot com
  2012-07-31  9:47 ` paolo at gcc dot gnu.org
  2012-07-31  9:50 ` paolo.carlini at oracle dot com
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-07-28 13:20 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2012-07-28
         AssignedTo|unassigned at gcc dot       |paolo.carlini at oracle dot
                   |gnu.org                     |com
   Target Milestone|---                         |4.8.0
     Ever Confirmed|0                           |1

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-07-28 13:20:08 UTC ---
Looking into it.


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

* [Bug c++/53624] GCC rejects function local types in template function with default template arguments
  2012-06-10  3:38 [Bug c++/53624] New: GCC rejects function local types in template function with default template arguments lunow at math dot hu-berlin.de
                   ` (4 preceding siblings ...)
  2012-07-28 13:20 ` paolo.carlini at oracle dot com
@ 2012-07-31  9:47 ` paolo at gcc dot gnu.org
  2012-07-31  9:50 ` paolo.carlini at oracle dot com
  6 siblings, 0 replies; 8+ messages in thread
From: paolo at gcc dot gnu.org @ 2012-07-31  9:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> 2012-07-31 09:46:59 UTC ---
Author: paolo
Date: Tue Jul 31 09:46:46 2012
New Revision: 190001

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=190001
Log:
/cp
2012-07-31  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/53624
    * pt.c (check_default_tmpl_args): Don't check local types.

/testsuite
2012-07-31  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/53624
    * g++.dg/cpp0x/temp_default5.C: New.


Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/temp_default5.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/53624] GCC rejects function local types in template function with default template arguments
  2012-06-10  3:38 [Bug c++/53624] New: GCC rejects function local types in template function with default template arguments lunow at math dot hu-berlin.de
                   ` (5 preceding siblings ...)
  2012-07-31  9:47 ` paolo at gcc dot gnu.org
@ 2012-07-31  9:50 ` paolo.carlini at oracle dot com
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-07-31  9:50 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #7 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-07-31 09:49:41 UTC ---
Fixed.


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

end of thread, other threads:[~2012-07-31  9:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-10  3:38 [Bug c++/53624] New: GCC rejects function local types in template function with default template arguments lunow at math dot hu-berlin.de
2012-06-10  4:24 ` [Bug c++/53624] " pinskia at gcc dot gnu.org
2012-06-10  4:49 ` lunow at math dot hu-berlin.de
2012-06-10  4:52 ` pinskia at gcc dot gnu.org
2012-07-28 13:18 ` paolo.carlini at oracle dot com
2012-07-28 13:20 ` paolo.carlini at oracle dot com
2012-07-31  9:47 ` paolo at gcc dot gnu.org
2012-07-31  9:50 ` 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).