| Summary: | Error due to CDT not recognizing compiler built-ins like __is_pod | ||
|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Nathan Ridge <zeratul976> |
| Component: | cdt-indexer | Assignee: | Sergey Prigogin <eclipse.sprigogin> |
| Status: | RESOLVED FIXED | QA Contact: | Markus Schorn <mschorn.eclipse> |
| Severity: | normal | ||
| Priority: | P3 | CC: | cdtdoug, eclipse.sprigogin, yevshif |
| Version: | 8.1.0 | ||
| Target Milestone: | 8.1.1 | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
| Bug Depends on: | 381000, 299911 | ||
| Bug Blocks: | |||
Please correct me if I'm wrong, but it seems to me that support for dependent expressions is orthogonal to support for compiler built-ins like __is_pod. CDT doesn't recognize built-ins like __is_pod even when they appear in a non-dependent context, for example:
template <bool> struct foo {};
template <> struct foo<true> { typedef int type; };
typedef foo<__is_pod(int)>::type t; // ERROR HERE
Should I file a separate bug for this?
Fixed by commit http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=3b7da721b60c53f8f3e5baedeb41542f9d28d0d8. *** cdt git genie on behalf of Sergey Prigogin ***
Bug 367993 - Error due to CDT not recognizing compiler built-ins like
__is_pod.
[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=3b7da721b60c53f8f3e5baedeb41542f9d28d0d8
*** cdt git genie on behalf of Sergey Prigogin ***
Bug 367993 - Error due to CDT not recognizing compiler built-ins like
__is_pod.
[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=fd7b8220ee5865c8d262dc4872d18d770ed89e9a
|
In the following code: template<typename T> struct is_pod { static const bool value = __is_pod(T); }; template <bool, typename = void> struct enable_if {}; template <typename T> struct enable_if<true, T> { typedef T type; }; template <typename T> void bar(typename enable_if<is_pod<T>::value>::type* = 0); int main() { bar<int>(); // ERROR HERE } CDT gives an error at the indicated line: "Invalid arguments 'Candidates are: void bar(enable_if<&0[is_pod<#0>::value],void>::type *)'" I'm assuming the cause of the error is that CDT does not recognize the __is_pod compiler builtin used to implement the is_pod type trait metafunction. What can be done about this? Could CDT support compiler builtins like __is_pod and work out the result of expressions like __is_pod(T) by using the definition of POD (and other traits) in the standard (see section 20.9.4.3)?