public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/37766]  New: [C++0x] ICE with function's default reference template parameter
@ 2008-10-08  5:37 florian dot goujeon at wanadoo dot fr
  2008-10-08  5:43 ` [Bug c++/37766] " florian dot goujeon at wanadoo dot fr
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: florian dot goujeon at wanadoo dot fr @ 2008-10-08  5:37 UTC (permalink / raw)
  To: gcc-bugs

The following piece of code:

=====================================================
#include <string>

const std::string space(" ");

template<const std::string& Str = space>
void f()
{
}

int main()
{
    f<>();
}
=====================================================


leads to a compiler internal error:
=====================================================
$ g++ -std=c++0x main.cpp space.cpp
main.cpp: In function 'int main()':
main.cpp:3: internal compiler error: Segmentation fault
=====================================================


This bug occurs with any reference template parameter (i.e. not only
std::string&).



I hope my reports are helpful :)

$ g++ -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc/configure --enable-languages='c c++' --disable-nls :
(reconfigured) ../gcc/configure --enable-languages='c c++' : (reconfigured)
../gcc/configure --enable-languages='c c++' --enable-shared --disable-static
--disable-nls
Thread model: posix
gcc version 4.4.0 20081005 (experimental) (GCC)


-- 
           Summary: [C++0x] ICE with function's default reference template
                    parameter
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: florian dot goujeon at wanadoo dot fr
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug c++/37766] [C++0x] ICE with function's default reference template parameter
  2008-10-08  5:37 [Bug c++/37766] New: [C++0x] ICE with function's default reference template parameter florian dot goujeon at wanadoo dot fr
@ 2008-10-08  5:43 ` florian dot goujeon at wanadoo dot fr
  2008-12-24 19:14 ` pinskia at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: florian dot goujeon at wanadoo dot fr @ 2008-10-08  5:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from florian dot goujeon at wanadoo dot fr  2008-10-08 05:42 -------
Sorry, bad command line:
=====================================================
$ g++ -std=c++0x main.cpp
main.cpp: In function 'int main()':
main.cpp:3: internal compiler error: Segmentation fault
=====================================================


-- 


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


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

* [Bug c++/37766] [C++0x] ICE with function's default reference template parameter
  2008-10-08  5:37 [Bug c++/37766] New: [C++0x] ICE with function's default reference template parameter florian dot goujeon at wanadoo dot fr
  2008-10-08  5:43 ` [Bug c++/37766] " florian dot goujeon at wanadoo dot fr
@ 2008-12-24 19:14 ` pinskia at gcc dot gnu dot org
  2008-12-24 19:15 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-24 19:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2008-12-24 19:13 -------
Reducing ...


-- 


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


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

* [Bug c++/37766] [C++0x] ICE with function's default reference template parameter
  2008-10-08  5:37 [Bug c++/37766] New: [C++0x] ICE with function's default reference template parameter florian dot goujeon at wanadoo dot fr
  2008-10-08  5:43 ` [Bug c++/37766] " florian dot goujeon at wanadoo dot fr
  2008-12-24 19:14 ` pinskia at gcc dot gnu dot org
@ 2008-12-24 19:15 ` pinskia at gcc dot gnu dot org
  2008-12-24 20:13 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-24 19:15 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
           Severity|major                       |normal


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


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

* [Bug c++/37766] [C++0x] ICE with function's default reference template parameter
  2008-10-08  5:37 [Bug c++/37766] New: [C++0x] ICE with function's default reference template parameter florian dot goujeon at wanadoo dot fr
                   ` (2 preceding siblings ...)
  2008-12-24 19:15 ` pinskia at gcc dot gnu dot org
@ 2008-12-24 20:13 ` pinskia at gcc dot gnu dot org
  2008-12-28 23:03 ` reichelt at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-24 20:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2008-12-24 20:11 -------
Reduced testcase:
const int a = 1;
template<const int& b = a> void f() {
  f<>();
}

-- CUT ---
Works with a struct though.

Confirmed, not a regression


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |ice-on-valid-code
      Known to fail|                            |4.3.3 4.4.0
   Last reconfirmed|0000-00-00 00:00:00         |2008-12-24 20:11:48
               date|                            |


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


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

* [Bug c++/37766] [C++0x] ICE with function's default reference template parameter
  2008-10-08  5:37 [Bug c++/37766] New: [C++0x] ICE with function's default reference template parameter florian dot goujeon at wanadoo dot fr
                   ` (3 preceding siblings ...)
  2008-12-24 20:13 ` pinskia at gcc dot gnu dot org
@ 2008-12-28 23:03 ` reichelt at gcc dot gnu dot org
  2009-07-12 22:03 ` reichelt at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2008-12-28 23:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from reichelt at gcc dot gnu dot org  2008-12-28 23:00 -------
Might be related to PR35828.


-- 

reichelt at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |reichelt at gcc dot gnu dot
                   |                            |org
           Keywords|                            |monitored


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


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

* [Bug c++/37766] [C++0x] ICE with function's default reference template parameter
  2008-10-08  5:37 [Bug c++/37766] New: [C++0x] ICE with function's default reference template parameter florian dot goujeon at wanadoo dot fr
                   ` (4 preceding siblings ...)
  2008-12-28 23:03 ` reichelt at gcc dot gnu dot org
@ 2009-07-12 22:03 ` reichelt at gcc dot gnu dot org
  2009-10-12  5:35 ` jason at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2009-07-12 22:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from reichelt at gcc dot gnu dot org  2009-07-12 22:03 -------
Probably due to the fix in PR35828 the original testcase and the one in comment
#3
now compile. However, if I leave out the two "const" in the testcase from
comment #3, the code is rejected which is wrong IMHO.


-- 

reichelt at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid


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


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

* [Bug c++/37766] [C++0x] ICE with function's default reference template parameter
  2008-10-08  5:37 [Bug c++/37766] New: [C++0x] ICE with function's default reference template parameter florian dot goujeon at wanadoo dot fr
                   ` (5 preceding siblings ...)
  2009-07-12 22:03 ` reichelt at gcc dot gnu dot org
@ 2009-10-12  5:35 ` jason at gcc dot gnu dot org
  2009-10-12 21:04 ` jason at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-10-12  5:35 UTC (permalink / raw)
  To: gcc-bugs



-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jason at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2008-12-24 20:11:48         |2009-10-12 05:34:56
               date|                            |


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


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

* [Bug c++/37766] [C++0x] ICE with function's default reference template parameter
  2008-10-08  5:37 [Bug c++/37766] New: [C++0x] ICE with function's default reference template parameter florian dot goujeon at wanadoo dot fr
                   ` (6 preceding siblings ...)
  2009-10-12  5:35 ` jason at gcc dot gnu dot org
@ 2009-10-12 21:04 ` jason at gcc dot gnu dot org
  2009-10-12 21:49 ` jason at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-10-12 21:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jason at gcc dot gnu dot org  2009-10-12 21:04 -------
Subject: Bug 37766

Author: jason
Date: Mon Oct 12 21:04:27 2009
New Revision: 152685

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=152685
Log:
        PR c++/37766
        * pt.c (type_unification_real): Call convert_template_argument
        for function default template arguments.
        (check_default_tmpl_args): Suggest -std=c++0x when function default
        template args seen in C++98 mode.

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


-- 


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


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

* [Bug c++/37766] [C++0x] ICE with function's default reference template parameter
  2008-10-08  5:37 [Bug c++/37766] New: [C++0x] ICE with function's default reference template parameter florian dot goujeon at wanadoo dot fr
                   ` (7 preceding siblings ...)
  2009-10-12 21:04 ` jason at gcc dot gnu dot org
@ 2009-10-12 21:49 ` jason at gcc dot gnu dot org
  2009-10-18  5:13 ` jason at gcc dot gnu dot org
  2009-10-18  5:17 ` jason at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-10-12 21:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jason at gcc dot gnu dot org  2009-10-12 21:49 -------
Fixed for 4.5; will backport for 4.4.3 after branch reopens.


-- 


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


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

* [Bug c++/37766] [C++0x] ICE with function's default reference template parameter
  2008-10-08  5:37 [Bug c++/37766] New: [C++0x] ICE with function's default reference template parameter florian dot goujeon at wanadoo dot fr
                   ` (8 preceding siblings ...)
  2009-10-12 21:49 ` jason at gcc dot gnu dot org
@ 2009-10-18  5:13 ` jason at gcc dot gnu dot org
  2009-10-18  5:17 ` jason at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-10-18  5:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jason at gcc dot gnu dot org  2009-10-18 05:13 -------
Subject: Bug 37766

Author: jason
Date: Sun Oct 18 05:13:05 2009
New Revision: 152966

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=152966
Log:
        PR c++/38798
        * parser.c (CP_PARSER_FLAGS_NO_TYPE_DEFINITIONS): New.
        (cp_parser_type_specifier): Don't try to parse a class-specifier
        or enum-specifier in that case.
        (cp_parser_trailing_type_id): New.
        (cp_parser_late_return_type_opt): Call it.
        (cp_parser_type_id_1): Add is_trailing_return parm.
        (cp_parser_type_specifier_seq): Likewise.

        PR c++/40092
        * tree.c (cp_tree_equal): Add test for TEMPLATE_PARM_PARAMETER_PACK
        equality.

        PR c++/37875
        * parser.c (cp_parser_decltype): Set greater_than_is_operator_p.

        PR c++/37766
        * pt.c (type_unification_real): Call convert_template_argument
        for function default template arguments.
        (check_default_tmpl_args): Suggest -std=c++0x when function default
        template args seen in C++98 mode.

        PR c++/37204
        * typeck.c (build_reinterpret_cast_1): Handle rvalue refs
        properly.


Added:
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/cpp0x/decltype18.C
      - copied unchanged from r152686,
trunk/gcc/testsuite/g++.dg/cpp0x/decltype18.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/cpp0x/fntmpdefarg1.C
      - copied unchanged from r152686,
trunk/gcc/testsuite/g++.dg/cpp0x/fntmpdefarg1.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/cpp0x/rv-reinterpret.C
      - copied unchanged from r152661,
trunk/gcc/testsuite/g++.dg/cpp0x/rv-reinterpret.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/cpp0x/trailing1.C
      - copied unchanged from r152924,
trunk/gcc/testsuite/g++.dg/cpp0x/trailing1.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/cpp0x/trailing2.C
      - copied unchanged from r152924,
trunk/gcc/testsuite/g++.dg/cpp0x/trailing2.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/cpp0x/trailing3.C
      - copied unchanged from r152924,
trunk/gcc/testsuite/g++.dg/cpp0x/trailing3.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/cpp0x/trailing4.C
      - copied unchanged from r152924,
trunk/gcc/testsuite/g++.dg/cpp0x/trailing4.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/cpp0x/trailing5.C
      - copied unchanged from r152924,
trunk/gcc/testsuite/g++.dg/cpp0x/trailing5.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/cpp0x/vt-40092.C
      - copied unchanged from r152751,
trunk/gcc/testsuite/g++.dg/cpp0x/vt-40092.C
Removed:
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/cpp0x/auto12.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/cpp0x/auto13.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/cpp0x/auto6.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/cpp0x/auto8.C
Modified:
    branches/gcc-4_4-branch/gcc/cp/ChangeLog
    branches/gcc-4_4-branch/gcc/cp/parser.c
    branches/gcc-4_4-branch/gcc/cp/pt.c
    branches/gcc-4_4-branch/gcc/cp/tree.c
    branches/gcc-4_4-branch/gcc/cp/typeck.c
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/37766] [C++0x] ICE with function's default reference template parameter
  2008-10-08  5:37 [Bug c++/37766] New: [C++0x] ICE with function's default reference template parameter florian dot goujeon at wanadoo dot fr
                   ` (9 preceding siblings ...)
  2009-10-18  5:13 ` jason at gcc dot gnu dot org
@ 2009-10-18  5:17 ` jason at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-10-18  5:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from jason at gcc dot gnu dot org  2009-10-18 05:17 -------
Fixed for 4.4.3.


-- 

jason at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2009-10-18  5:17 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-08  5:37 [Bug c++/37766] New: [C++0x] ICE with function's default reference template parameter florian dot goujeon at wanadoo dot fr
2008-10-08  5:43 ` [Bug c++/37766] " florian dot goujeon at wanadoo dot fr
2008-12-24 19:14 ` pinskia at gcc dot gnu dot org
2008-12-24 19:15 ` pinskia at gcc dot gnu dot org
2008-12-24 20:13 ` pinskia at gcc dot gnu dot org
2008-12-28 23:03 ` reichelt at gcc dot gnu dot org
2009-07-12 22:03 ` reichelt at gcc dot gnu dot org
2009-10-12  5:35 ` jason at gcc dot gnu dot org
2009-10-12 21:04 ` jason at gcc dot gnu dot org
2009-10-12 21:49 ` jason at gcc dot gnu dot org
2009-10-18  5:13 ` jason at gcc dot gnu dot org
2009-10-18  5:17 ` jason at gcc dot gnu dot org

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).