Bug 302510 - KDevelop errors out on user-defined string literal operators
Summary: KDevelop errors out on user-defined string literal operators
Status: RESOLVED UPSTREAM
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (Clang-based) (show other bugs)
Version: git master
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: 5.0.0
Assignee: kdevelop-bugs-null
URL:
Keywords: junior-jobs
Depends on:
Blocks:
 
Reported: 2012-06-25 14:35 UTC by Alexander
Modified: 2016-03-24 22:08 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander 2012-06-25 14:35:59 UTC
I'm using KDevelop git master (2012-06-25).
Consider the following code:

#include <chrono>
constexpr std::chrono::nanoseconds operator"" _nsec(unsigned long long val)
{
	return std::chrono::nanoseconds(val);
}

The "constexpr..." line is highlighted in red, with the following errors in the Problems tool view:
"Unexpected token 'string literal'", "Unexpected token 'operator'".

See http://en.wikipedia.org/wiki/C%2B%2B11#User-defined_literals for more info.

Thanks

Reproducible: Always

Steps to Reproduce:
1. Try the code sample

Actual Results:  
KDevelop shows errors

Expected Results:  
There shouldn't be any errors. Even better, KDevelop should treat the user-defined string literals as values having the types returned by respective operators defined in current namespace.

openSUSE 12.1 x86-64, gcc 4.7.1.
Comment 1 Kevin Funk 2013-12-28 21:32:02 UTC
Patch in progress: https://git.reviewboard.kde.org/r/103485/
Comment 2 Kevin Funk 2016-03-24 13:45:47 UTC
Works in principal in KDevelop 5, using the Clang backend. But there's a bug.

Example:
```
#include <chrono>
constexpr std::chrono::nanoseconds operator"" _nsec(unsigned long long val)
{
	return std::chrono::nanoseconds(val);
}

auto i = 123_nsec
```

Highlight the second '_nsec'.

Issue: Definition is the range 'operator', not the first '_nsec'
Comment 3 Kevin Funk 2016-03-24 22:08:52 UTC
Upstream issue. Patch at http://reviews.llvm.org/D18462