gcc编译标志在编译期间抑制模板扩展模板错误? [英] gcc compiler flag to suppress template expansion for template errors during compilation?

查看:166
本文介绍了gcc编译标志在编译期间抑制模板扩展模板错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有gcc编译器的标志或修改,它将返回一个行号和句子,当遇到涉及模板​​的错误时会说明错误类型,但会打印

I'm wondering if there is a flag or modification for the gcc compiler that will return a line number and sentence explaining the type of error when it encounters an error involving templates, but will not print the page of template expansion code spaghetti that invariably follow such errors.

例如,而不是像这样的错误:

For example, instead of an error like this:

temp.cc:9: error: ‘class std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char,     std::char_traits<char>, std::allocator<char> > > > >’ has no member named ‘hat’

我想要这样的:

temp.cc:9: error: class has no member named hat.


推荐答案

编译器试图帮助您识别导致问题的类。它只知道该类作为其模板类型的扩展。

There isnt one. The compiler is trying to help you identify the class that is causing the problem. It only knows of that class as the expansion of its template types.

这篇关于gcc编译标志在编译期间抑制模板扩展模板错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆