https://qa.mandrakesoft.com/show_bug.cgi?id=284

[EMAIL PROTECTED] changed:

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



------- Additional Comments From [EMAIL PROTECTED]  2003-02-08 16:27 -------
Fixed in 2.96-0.81mdk.

[gb@hp6 vrac]$ g++-2.96 -c inv.cpp
inv.cpp:11: ISO C++ forbids declaration of `inv' with no type
inv.cpp: In function `T inv (T) [with T = char *]':
inv.cpp:23:   instantiated from here
inv.cpp:6: wrong type argument to unary minus




------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



------- Reminder: -------
assigned_to: [EMAIL PROTECTED]
status: RESOLVED
creation_date: 
description: 
$ g++ inv.cc 
inv.cc:11: Internal error: Segmentation fault.
Please submit a full bug report.
See <URL:https://qa.mandrakesoft.com/> for instructions.
===
g++ segfaults with the following code "I know it contains errors cause i'm 
still learning C++ but it shouldn't segfault"
---inv.cc---
#include <iostream>
#include <cstdlib>
using std::cout;

template <typename T>  T inv (T t) {
  return -t;
}

// i want a function for chars only :PPPPPPPPPPPPPPPPPPPPPPP
T inv(char t)
{

return 0;
}

int main(int argc, char *argv[])
{
if (!argv[1]) {
cout <<"You didn't enter anything" << endl;
return 1;
}
cout <<"You entered: " << argv[1] << endl;
cout <<"The result is: " << atoi(inv(argv[1])) << endl;
return 0;
}

---inv.cc---

Reply via email to