<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/132178>132178</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [libcxx] Ambiguous Reference to std::pair in SPEC2006 447.dealII Example When Using libc++
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            libc++
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          andrewW0210
      </td>
    </tr>
</table>

<pre>
    When compiling the code from the SPEC2006 447.dealII benchmark with libc++, an ambiguous reference to std::pair occurs. The problematic code like this:

``` cpp
#include <utility>
namespace std {
template <typename T1, typename T2> struct pair;
} // namespace std

std::pair<unsigned, unsigned> test() { return std::make_pair(1u, 2u); }
```

The error message is:

```
test.cpp:6:6: error: reference to 'pair' is ambiguous
    6 | std::pair<unsigned, unsigned> test() { return std::make_pair(1u, 2u); }
 |      ^
../riscv64-unknown-elf/include/c++/v1/__utility/pair.h:79:29: note: candidate found by name lookup is 'std::__1::pair'
   79 | struct _LIBCPP_TEMPLATE_VIS pair
      | ^
test.cpp:3:44: note: candidate found by name lookup is 'std::pair'
    3 | template <typename T1, typename T2> struct pair;
      | ^
1 error generated.
```

Is there a recommended approach to resolve this issue without modifying the SPEC2006 source code? Could libc++ provide a mechanism to handle such forward declarations gracefully?
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy8VU1v4zYQ_TX0ZRCDImXJPuigOBYQYAsE3bR7NChybLGhSIEfzvrfF5S8-Wi3lxZowEAiwOF78-bpWYSgzxaxIZt7snlYiRQH5xthlcfXb5QVdNU7dW2-DWhBunHSRtszxAFBOoVw8m6cd1-fDntGaQVlWa8VCvP4CD1aOYzCv8CrjgMY3UvC7ue1B2FBjL0-J5cCeDyhRysRooMQFeEt4e0ktAcnZfJhDc8DwuRdb3AUUcsF3ugXhDjokAvovCq6LJDTlPeMaytNUgiE71PURscr4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