Check that make_pair's template arguments are deduced. G++ 4.6 in C++0x 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 containing
(filename, clean_lines, linenum, error)
| 4581 | |
| 4582 | |
| 4583 | def CheckMakePairUsesDeduction(filename, clean_lines, linenum, error): |
| 4584 | """Check that make_pair's template arguments are deduced. |
| 4585 | |
| 4586 | G++ 4.6 in C++0x mode fails badly if make_pair's template arguments are |
| 4587 | specified explicitly, and such use isn't intended in any case. |
| 4588 | |
| 4589 | Args: |
| 4590 | filename: The name of the current file. |
| 4591 | clean_lines: A CleansedLines instance containing the file. |
| 4592 | linenum: The number of the line to check. |
| 4593 | error: The function to call with any errors found. |
| 4594 | """ |
| 4595 | line = clean_lines.elided[linenum] |
| 4596 | match = _RE_PATTERN_EXPLICIT_MAKEPAIR.search(line) |
| 4597 | if match: |
| 4598 | error(filename, linenum, 'build/explicit_make_pair', |
| 4599 | 4, # 4 = high confidence |
| 4600 | 'For C++11-compatibility, omit template arguments from make_pair' |
| 4601 | ' OR use pair directly OR if appropriate, construct a pair directly') |
| 4602 | |
| 4603 | |
| 4604 | def ProcessLine(filename, file_extension, clean_lines, line, |