Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 367993 - Error due to CDT not recognizing compiler built-ins like __is_pod
Summary: Error due to CDT not recognizing compiler built-ins like __is_pod
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-indexer (show other bugs)
Version: 8.1.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 8.1.1   Edit
Assignee: Sergey Prigogin CLA
QA Contact: Markus Schorn CLA
URL:
Whiteboard:
Keywords:
Depends on: 381000 299911
Blocks:
  Show dependency tree
 
Reported: 2012-01-05 18:15 EST by Nathan Ridge CLA
Modified: 2013-02-27 11:50 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nathan Ridge CLA 2012-01-05 18:15:29 EST
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)?
Comment 1 Nathan Ridge CLA 2012-01-11 14:38:10 EST
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?
Comment 3 CDT Genie CLA 2013-02-27 11:50:12 EST
*** 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
Comment 4 CDT Genie CLA 2013-02-27 11:50:14 EST
*** 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