[PATCH, gcc 8] C++: hints for missing std:: headers

Nathan Sidwell nathan@acm.org
Tue Apr 25 11:44:00 GMT 2017


On 04/24/2017 03:53 PM, David Malcolm wrote:
> If the user forgets to include an STL header, then an attempt
> to use a class in an explicitly scoped "std::" currently leads to
> this error:
> 

> +  if (scope == NULL_TREE)
> +    return;
> +  if (TREE_CODE (scope) != NAMESPACE_DECL)
> +    return;
> +  /* We only offer suggestions for the "std" namespace.  */
> +  if (scope != std_node)
> +    return;

You might also consider if the current scope has a using directive 
naming ::std?  That could be a separate patch, if you care.

Ok for trunk.

nathan
-- 
Nathan Sidwell



More information about the Gcc-patches mailing list