Bug 278482

Summary: KDevelop treats signed and unsigned chars as ints when used as template parameters
Product: [Applications] kdevelop Reporter: Alexander Shaduri <ashaduri>
Component: Language Support: CPP (old)Assignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: normal CC: cponnapalli
Priority: NOR    
Version First Reported In: git master   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In: 5.0.0
Sentry Crash Report:
Attachments: unsigned char when used as template
Signed char used as template

Description Alexander Shaduri 2011-07-25 16:43:25 UTC
Version:           git master (using KDE 4.6.3) 
OS:                Linux

I'm using KDevelop git master from 2011-07-25.
The following example demonstrates the problem:

template<typename T>
struct S { };

void func()
{
	S<signed char> s1;  // incorrectly treats as signed int
	S<unsigned char> s2;  // incorrectly treats as unsigned int
	signed char c1;  // correctly treats as signed char
}

Thanks!

Reproducible: Always

Steps to Reproduce:
Paste the above example into some .cpp file, move the mouse over s1 and s2.


Expected Results:  
char should be treated as char, not int.

openSUSE 11.3 x86_64
Comment 1 chaitanya srinivas ponnapalli 2016-05-01 19:36:00 UTC
Created attachment 98737 [details]
unsigned char when used as template

Reproduced the above steps:
	1. Executed the code given.
	2. Kdevelop does not treat the signed char type as signed int.
	3. Similarly, unsigned char is not treated as unsigned int.
	4. Attached the screen shots containing the code executed.
	
In accordance to the statement in expected result:

A char is both a character representation, but for the purposes of converting to an int, it's also a int representation. A simple char is used to store simple characters. However, if you are using character types as numbers then use signed char(-127 t0 +127 range) and unsigned char(0 t0 255.)
Comment 2 chaitanya srinivas ponnapalli 2016-05-01 19:36:36 UTC
Created attachment 98738 [details]
Signed char used as template
Comment 3 Kevin Funk 2016-05-01 20:19:14 UTC
Fixed in KDevelop 5, indeed.