Skip to content

"no instance of function template" occurs when using chrono #1753

@sean-mcmanus

Description

@sean-mcmanus

Is anyone else hitting this?

using namespace std;  
class foo
{public:
	int func()
	{
			chrono::time_point<chrono::system_clock> now = chrono::system_clock::now();
			chrono::time_point<chrono::system_clock> now2 = chrono::system_clock::now();
			auto ms = chrono::duration_cast<chrono::milliseconds>(now2 - now);
                        return 0;
	}
}

Error is 'no instance of function template "std::chrono::duration_cast" matches the argument list -- argument types are: (<error-type>)', with hovering over "now" showing an in the 2nd template arg.

Repros with clang-x64 mode with clang and gcc 6 headers (on all OS's).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Language ServicebugfixedCheck the Milestone for the release in which the fix is or will be available.parser

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions