GCC 除錯/g++/警告
外觀
- 在 GCC 版本 4.5.1 中發現的訊息
- 通常與訊息配對
- 注意: (如果這不是您的本意,請確保函式模板已宣告,並在此處在函式名稱後新增 <>)
template <typename T>
class Foo {
public:
T data;
friend void Bar(Foo<T> &);
};
template <typename T> void Bar(Foo<T> &f) {
cout << f.data << endl;
}
可能的修復?
template <typename TT> void Bar(TT &);
template <typename T>
class Foo {
public:
T data;
friend void Bar<>(Foo<T> &);
};
template <typename TT> void Bar(TT &f) {
cout << f.data << endl;
}
ISO C++ 認為這些是模稜兩可的,即使第一個的最差轉換比第二個的最差轉換更好
- 在 GCC 版本 ? 中發現的訊息
- 可能是自定義定義的型別轉換干擾了類定義中的另一個轉換
- 在 GCC 版本 4.4.3, 4.5.1 中發現的訊息
- 有時與警告配對:"隱式常量轉換溢位"
- 可能是由於在字元賦值中使用正斜槓而不是反斜槓造成的。
char mrChar = '/0'; // instead of: char mrChar = '\0';
- 在 GCC 版本 ? 中發現的訊息
- 您正在向字串函式傳遞一個空引數
strcpy(mrChar, '\0'); // won't work, null argument ('\0') supplied
strcpy(mrChar, ""); // will work?