Check that make_pair's template arguments are deduced. G++ 4.6 in C++11 mode fails badly if make_pair's template arguments are specified explicitly, and such use isn't intended in any case. Args: filename: The name of the current file. clean_lines: A CleansedLines instance
(filename, clean_lines, linenum, error)
| 7038 | |
| 7039 | |
| 7040 | def CheckMakePairUsesDeduction(filename, clean_lines, linenum, error): |
| 7041 | """Check that make_pair's template arguments are deduced. |
| 7042 | |
| 7043 | G++ 4.6 in C++11 mode fails badly if make_pair's template arguments are |
| 7044 | specified explicitly, and such use isn't intended in any case. |
| 7045 | |
| 7046 | Args: |
| 7047 | filename: The name of the current file. |
| 7048 | clean_lines: A CleansedLines instance containing the file. |
| 7049 | linenum: The number of the line to check. |
| 7050 | error: The function to call with any errors found. |
| 7051 | """ |
| 7052 | line = clean_lines.elided[linenum] |
| 7053 | match = _RE_PATTERN_EXPLICIT_MAKEPAIR.search(line) |
| 7054 | if match: |
| 7055 | error( |
| 7056 | filename, |
| 7057 | linenum, |
| 7058 | "build/explicit_make_pair", |
| 7059 | 4, # 4 = high confidence |
| 7060 | "For C++11-compatibility, omit template arguments from make_pair" |
| 7061 | " OR use pair directly OR if appropriate, construct a pair directly", |
| 7062 | ) |
| 7063 | |
| 7064 | |
| 7065 | def CheckRedundantVirtual(filename, clean_lines, linenum, error): |