public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/53307] New: internal crash with variadic templates and decltype
@ 2012-05-10 13:54 chesstr at hotmail dot com
  2012-05-10 17:14 ` [Bug c++/53307] " chesstr at hotmail dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: chesstr at hotmail dot com @ 2012-05-10 13:54 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 53307
           Summary: internal crash with variadic templates and decltype
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: chesstr@hotmail.com


Created attachment 27363
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27363
gcc_bug.cpp

Simplified code in the attachment gives below error :

gcc_bug.cpp:18:6: internal compiler error: Segmentation fault


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

* [Bug c++/53307] internal crash with variadic templates and decltype
  2012-05-10 13:54 [Bug c++/53307] New: internal crash with variadic templates and decltype chesstr at hotmail dot com
@ 2012-05-10 17:14 ` chesstr at hotmail dot com
  2012-05-10 17:18 ` chesstr at hotmail dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: chesstr at hotmail dot com @ 2012-05-10 17:14 UTC (permalink / raw)
  To: gcc-bugs

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

chesstr at hotmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|major                       |normal


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

* [Bug c++/53307] internal crash with variadic templates and decltype
  2012-05-10 13:54 [Bug c++/53307] New: internal crash with variadic templates and decltype chesstr at hotmail dot com
  2012-05-10 17:14 ` [Bug c++/53307] " chesstr at hotmail dot com
@ 2012-05-10 17:18 ` chesstr at hotmail dot com
  2012-05-10 20:11 ` chesstr at hotmail dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: chesstr at hotmail dot com @ 2012-05-10 17:18 UTC (permalink / raw)
  To: gcc-bugs

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

chesstr at hotmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #27363|0                           |1
        is obsolete|                            |

--- Comment #1 from chesstr at hotmail dot com 2012-05-10 17:16:47 UTC ---
Created attachment 27366
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27366
better test case

It turns out, if the length of parameter pack arg3s... is 0 this bug occurs, if
it is not 0 then gcc compiles without any problem.


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

* [Bug c++/53307] internal crash with variadic templates and decltype
  2012-05-10 13:54 [Bug c++/53307] New: internal crash with variadic templates and decltype chesstr at hotmail dot com
  2012-05-10 17:14 ` [Bug c++/53307] " chesstr at hotmail dot com
  2012-05-10 17:18 ` chesstr at hotmail dot com
@ 2012-05-10 20:11 ` chesstr at hotmail dot com
  2012-05-10 21:04 ` chesstr at hotmail dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: chesstr at hotmail dot com @ 2012-05-10 20:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from chesstr at hotmail dot com 2012-05-10 20:09:44 UTC ---
Comment on attachment 27366
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27366
better test case

>#include <iostream>
>template<class...Ts> struct tuple{};
>
>struct funct{
>	template<class T,class...argTs>
>	T operator()(T arg1,argTs...args){
>		return arg1;
>	}
>};
>
>template<class...>class test;
>
>template< template <class...> class tp,
>	  class...arg1Ts,
>	  class...arg2Ts> 
>class test<tp<arg1Ts...>,tp<arg2Ts...>>{
>public:
>template<class func>
>auto test_pass(func fun,arg2Ts...arg2s) -> decltype(fun(arg2s...)) 
>{
>	int gcc_compiles_this;
>	int internal_gcc_crash=sizeof...(arg2s);
>	return fun(arg2s...);
>}
>template<class func,class...arg3Ts>
>auto testbug(func fun,arg2Ts...arg2s,arg3Ts...arg3s) -> decltype(fun(arg2s...,arg3s...)) 
>{
>	int clang_compiles_but_not_gcc;
>	int internal_gcc_crash=sizeof...(arg2s);
>	return fun(arg2s...,arg3s...);
>}
>};
>
>int main(){	
>	test<tuple<>,tuple<char,int>> t;
>	std::cout<<t.test_pass(funct(),'a',2);
>       std::cout<<t.testbug(funct(),'a',2,100.123);//works fine
>	//std::cout<<t.testbug(funct(),'a',2,"str");//fails <<<<<<<<<<<<<<<<<------------------------
>	std::cout<<"gcc crash : "<<t.testbug(funct(),'a',2);//fails <<<<<<<<<<<<<<<<<<<--------------
>}


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

* [Bug c++/53307] internal crash with variadic templates and decltype
  2012-05-10 13:54 [Bug c++/53307] New: internal crash with variadic templates and decltype chesstr at hotmail dot com
                   ` (2 preceding siblings ...)
  2012-05-10 20:11 ` chesstr at hotmail dot com
@ 2012-05-10 21:04 ` chesstr at hotmail dot com
  2012-10-09 23:14 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: chesstr at hotmail dot com @ 2012-05-10 21:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from chesstr at hotmail dot com 2012-05-10 20:57:25 UTC ---
Therefore, it seems that 0 length argument packs are not handled correctly in
decltype.


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

* [Bug c++/53307] internal crash with variadic templates and decltype
  2012-05-10 13:54 [Bug c++/53307] New: internal crash with variadic templates and decltype chesstr at hotmail dot com
                   ` (3 preceding siblings ...)
  2012-05-10 21:04 ` chesstr at hotmail dot com
@ 2012-10-09 23:14 ` paolo.carlini at oracle dot com
  2012-10-09 23:37 ` paolo at gcc dot gnu.org
  2012-10-09 23:40 ` paolo.carlini at oracle dot com
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-10-09 23:14 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |4.7.2, 4.8.0

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-10-09 23:14:06 UTC ---
This is fixed in 4.7.2 and mainline. I'm adding the testcase.


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

* [Bug c++/53307] internal crash with variadic templates and decltype
  2012-05-10 13:54 [Bug c++/53307] New: internal crash with variadic templates and decltype chesstr at hotmail dot com
                   ` (4 preceding siblings ...)
  2012-10-09 23:14 ` paolo.carlini at oracle dot com
@ 2012-10-09 23:37 ` paolo at gcc dot gnu.org
  2012-10-09 23:40 ` paolo.carlini at oracle dot com
  6 siblings, 0 replies; 8+ messages in thread
From: paolo at gcc dot gnu.org @ 2012-10-09 23:37 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #5 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> 2012-10-09 23:37:12 UTC ---
Author: paolo
Date: Tue Oct  9 23:37:07 2012
New Revision: 192279

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

    PR c++/53307
    * g++.dg/cpp0x/decltype44.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/decltype44.C
Modified:
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/53307] internal crash with variadic templates and decltype
  2012-05-10 13:54 [Bug c++/53307] New: internal crash with variadic templates and decltype chesstr at hotmail dot com
                   ` (5 preceding siblings ...)
  2012-10-09 23:37 ` paolo at gcc dot gnu.org
@ 2012-10-09 23:40 ` paolo.carlini at oracle dot com
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-10-09 23:40 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.7.2

--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-10-09 23:40:12 UTC ---
Done.


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

end of thread, other threads:[~2012-10-09 23:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-10 13:54 [Bug c++/53307] New: internal crash with variadic templates and decltype chesstr at hotmail dot com
2012-05-10 17:14 ` [Bug c++/53307] " chesstr at hotmail dot com
2012-05-10 17:18 ` chesstr at hotmail dot com
2012-05-10 20:11 ` chesstr at hotmail dot com
2012-05-10 21:04 ` chesstr at hotmail dot com
2012-10-09 23:14 ` paolo.carlini at oracle dot com
2012-10-09 23:37 ` paolo at gcc dot gnu.org
2012-10-09 23:40 ` 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).