error: reference to ‘__detail’ is ambiguous
Ed Smith-Rowland
3dw4rd@verizon.net
Tue Jun 11 11:01:00 GMT 2013
On 06/11/2013 04:53 AM, Paolo Carlini wrote:
> On 06/11/2013 02:35 AM, Ed Smith-Rowland wrote:
>> On 06/09/2013 04:25 PM, Jonathan Wakely wrote:
>>> Ed, I'm seeing errors using -std=c++1y with this code:
>>>
>>> #include <chrono>
>>> #include <random>
>>>
>>> int main()
>>> {
>>> }
>>>
>>> I think this is due to you chrono literals patch, could you take a
>>> look please?
>>>
>> Here is a simple fix. Just rename __detail to __select_type.
>>
>> Built and tests on x86_64-linux.
>>
>> OK?
> Ok, but remember to adjust the comment on the closed curly bracket.
>
> By the way, stylistically, I don't see why namespaces should have the
> open curly bracket at the end of the line instead of the beginning of
> the next line, the standard GNU rule. If you can, please fix that
> formatting too.
>
> Thanks,
> Paolo.
>
Thanks for the catch.
I committed the attached with fix and formatting comment issues resolved.
Ed
-------------- next part --------------
2013-06-11 Ed Smith-Rowland <3dw4rd@verizon.net>
Fix library literals error involving namespace __detail.
* include/std/chrono: Rename __detail to __select_type. Reformat.
* include/bits/basic_string.h: Reformat.
* testsuite/20_util/duration/literals/ns_detail.cc: New.
-------------- next part --------------
Index: include/bits/basic_string.h
===================================================================
--- include/bits/basic_string.h (revision 199947)
+++ include/bits/basic_string.h (working copy)
@@ -3105,8 +3105,10 @@
#if __cplusplus > 201103L
- inline namespace literals {
- inline namespace string_literals {
+ inline namespace literals
+ {
+ inline namespace string_literals
+ {
inline basic_string<char>
operator"" s(const char* __str, size_t __len)
Index: include/std/chrono
===================================================================
--- include/std/chrono (revision 199947)
+++ include/std/chrono (working copy)
@@ -782,10 +782,13 @@
#if __cplusplus > 201103L
- inline namespace literals {
- inline namespace chrono_literals {
+ inline namespace literals
+ {
+ inline namespace chrono_literals
+ {
- namespace __detail {
+ namespace __select_type
+ {
using namespace __parse_int;
@@ -804,7 +807,7 @@
constexpr typename _Select_type<_Val, _Dur>::type
_Select_type<_Val, _Dur>::value;
- } // __detail
+ } // __select_type
constexpr chrono::duration<long double, ratio<3600,1>>
operator"" h(long double __hours)
@@ -812,11 +815,11 @@
template <char... _Digits>
constexpr typename
- __detail::_Select_type<__select_int::_Select_int<_Digits...>::value,
+ __select_type::_Select_type<__select_int::_Select_int<_Digits...>::value,
chrono::hours>::type
operator"" h()
{
- return __detail::_Select_type<
+ return __select_type::_Select_type<
__select_int::_Select_int<_Digits...>::value,
chrono::hours>::value;
}
@@ -827,11 +830,11 @@
template <char... _Digits>
constexpr typename
- __detail::_Select_type<__select_int::_Select_int<_Digits...>::value,
+ __select_type::_Select_type<__select_int::_Select_int<_Digits...>::value,
chrono::minutes>::type
operator"" min()
{
- return __detail::_Select_type<
+ return __select_type::_Select_type<
__select_int::_Select_int<_Digits...>::value,
chrono::minutes>::value;
}
@@ -842,11 +845,11 @@
template <char... _Digits>
constexpr typename
- __detail::_Select_type<__select_int::_Select_int<_Digits...>::value,
+ __select_type::_Select_type<__select_int::_Select_int<_Digits...>::value,
chrono::seconds>::type
operator"" s()
{
- return __detail::_Select_type<
+ return __select_type::_Select_type<
__select_int::_Select_int<_Digits...>::value,
chrono::seconds>::value;
}
@@ -857,11 +860,11 @@
template <char... _Digits>
constexpr typename
- __detail::_Select_type<__select_int::_Select_int<_Digits...>::value,
+ __select_type::_Select_type<__select_int::_Select_int<_Digits...>::value,
chrono::milliseconds>::type
operator"" ms()
{
- return __detail::_Select_type<
+ return __select_type::_Select_type<
__select_int::_Select_int<_Digits...>::value,
chrono::milliseconds>::value;
}
@@ -872,11 +875,11 @@
template <char... _Digits>
constexpr typename
- __detail::_Select_type<__select_int::_Select_int<_Digits...>::value,
+ __select_type::_Select_type<__select_int::_Select_int<_Digits...>::value,
chrono::microseconds>::type
operator"" us()
{
- return __detail::_Select_type<
+ return __select_type::_Select_type<
__select_int::_Select_int<_Digits...>::value,
chrono::microseconds>::value;
}
@@ -887,11 +890,11 @@
template <char... _Digits>
constexpr typename
- __detail::_Select_type<__select_int::_Select_int<_Digits...>::value,
+ __select_type::_Select_type<__select_int::_Select_int<_Digits...>::value,
chrono::nanoseconds>::type
operator"" ns()
{
- return __detail::_Select_type<
+ return __select_type::_Select_type<
__select_int::_Select_int<_Digits...>::value,
chrono::nanoseconds>::value;
}
Index: testsuite/20_util/duration/literals/ns_detail.cc
===================================================================
--- testsuite/20_util/duration/literals/ns_detail.cc (revision 0)
+++ testsuite/20_util/duration/literals/ns_detail.cc (working copy)
@@ -0,0 +1,7 @@
+// { dg-options "-std=gnu++1y" }
+// { dg-do compile }
+
+// Test error: reference to '__detail' is ambiguous
+
+#include <chrono>
+#include <random>
More information about the Libstdc++
mailing list