You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by Liviu Nicoara <ni...@hates.ms> on 2012/09/25 22:46:55 UTC
STDCXX-1070
I filed 1070, failure to build 22.locale.collate.cpp on Linux with gcc 4.7.1. Gcc, Comeau and Clang fail to compile it, Intel and Sun are fine. It looks to me like Intel and Sun compilers are not doing the right thing. A small test case and a patch have been attached. The failing code has been reduced to:
$ cat test.cpp; g++ -c test.cpp
template < class charT >
void f ()
{
g (charT ('a'));
}
template < class charT >
void g (charT)
{
}
int h ()
{
return f< char > (), 0;
}
test.cpp: In instantiation of 'void f() \[with charT = char\]':
test.cpp:14:23: required from here
test.cpp:4:5: error: 'g' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation \[-fpermissive\]
test.cpp:8:6: note: 'template<class charT> void g(charT)' declared here, later in the translation unit
Liviu
Re: STDCXX-1070
Posted by Wojciech Meyer <wo...@googlemail.com>.
Martin Sebor <ms...@gmail.com> writes:
>> Clear to go ahead here?
>
> You mean apply the patch attached to STDCXX-1070? It looks good
> to me. I also checked the test. It's odd that the problem didn't
> get caught sooner (we did get errors when the function templates
> were declared static, which is why the static keyword is commented
> out). But it sure does look like a problem.
>
> FWIW, if you want quick input on a patch, I find it easier when
> it's posted to the list (instead of attaching it to the issue).
> Attaching it is useful when it's large and/or when you don't
> have commit permissions. Others may have a different preference.
My personal preference would be both.
>
> Martin
>
>>
>> Thanks,
>> Liviu
>>
>
Thanks,
--
Wojciech Meyer
http://danmey.org
Re: STDCXX-1070
Posted by Martin Sebor <ms...@gmail.com>.
On 09/26/2012 04:55 PM, Liviu Nicoara wrote:
> On 9/25/12 7:56 PM, Liviu Nicoara wrote:
>> On 9/25/12 7:50 PM, Martin Sebor wrote:
>>> On 09/25/2012 02:46 PM, Liviu Nicoara wrote:
>>>> I filed 1070, failure to build 22.locale.collate.cpp on Linux with gcc
>>>> 4.7.1. Gcc, Comeau and Clang fail to compile it, Intel and Sun are
>>>> fine.
>>>> It looks to me like Intel and Sun compilers are not doing the right
>>>> thing. A small test case and a patch have been attached. The failing
>>>> code has been reduced to:
>>>
>>> I agree that the test case is ill-formed and requires a diagnostic.
>>>
>>> I haven't looked at the test so just to make sure the test case does
>>> reflect the problem there: the well-formedness depends on whether
>>> charT is a class type. If so, then the code would be okay because g()
>>> would be found via associated namespace lookup. I.e., this would be
>>> fine:
>>
>> Right. The test uses builtin types, therefore the argument-dependent
>> lookup does
>> not find g. The patch simply adds the declarations before the function
>> that uses
>> them.
>
> Clear to go ahead here?
You mean apply the patch attached to STDCXX-1070? It looks good
to me. I also checked the test. It's odd that the problem didn't
get caught sooner (we did get errors when the function templates
were declared static, which is why the static keyword is commented
out). But it sure does look like a problem.
FWIW, if you want quick input on a patch, I find it easier when
it's posted to the list (instead of attaching it to the issue).
Attaching it is useful when it's large and/or when you don't
have commit permissions. Others may have a different preference.
Martin
>
> Thanks,
> Liviu
>
Re: STDCXX-1070
Posted by Liviu Nicoara <ni...@hates.ms>.
On 9/25/12 7:56 PM, Liviu Nicoara wrote:
> On 9/25/12 7:50 PM, Martin Sebor wrote:
>> On 09/25/2012 02:46 PM, Liviu Nicoara wrote:
>>> I filed 1070, failure to build 22.locale.collate.cpp on Linux with gcc
>>> 4.7.1. Gcc, Comeau and Clang fail to compile it, Intel and Sun are fine.
>>> It looks to me like Intel and Sun compilers are not doing the right
>>> thing. A small test case and a patch have been attached. The failing
>>> code has been reduced to:
>>
>> I agree that the test case is ill-formed and requires a diagnostic.
>>
>> I haven't looked at the test so just to make sure the test case does
>> reflect the problem there: the well-formedness depends on whether
>> charT is a class type. If so, then the code would be okay because g()
>> would be found via associated namespace lookup. I.e., this would be
>> fine:
>
> Right. The test uses builtin types, therefore the argument-dependent lookup does
> not find g. The patch simply adds the declarations before the function that uses
> them.
Clear to go ahead here?
Thanks,
Liviu
Re: STDCXX-1070
Posted by Liviu Nicoara <ni...@hates.ms>.
On 9/25/12 7:50 PM, Martin Sebor wrote:
> On 09/25/2012 02:46 PM, Liviu Nicoara wrote:
>> I filed 1070, failure to build 22.locale.collate.cpp on Linux with gcc
>> 4.7.1. Gcc, Comeau and Clang fail to compile it, Intel and Sun are fine.
>> It looks to me like Intel and Sun compilers are not doing the right
>> thing. A small test case and a patch have been attached. The failing
>> code has been reduced to:
>
> I agree that the test case is ill-formed and requires a diagnostic.
>
> I haven't looked at the test so just to make sure the test case does
> reflect the problem there: the well-formedness depends on whether
> charT is a class type. If so, then the code would be okay because g()
> would be found via associated namespace lookup. I.e., this would be
> fine:
Right. The test uses builtin types, therefore the argument-dependent lookup does
not find g. The patch simply adds the declarations before the function that uses
them.
Liviu
>
> template <class charT>
> void f () { g (charT ()); }
>
> template <class charT>
> void g (charT) { }
>
> struct S { };
>
> void h () { f<S>(); }
>
> Martin
>
>>
>> $ cat test.cpp; g++ -c test.cpp
>> template < class charT >
>> void f ()
>> {
>> g (charT ('a'));
>> }
>>
>> template < class charT >
>> void g (charT)
>> {
>> }
>>
>> int h ()
>> {
>> return f< char > (), 0;
>> }
>> test.cpp: In instantiation of 'void f() \[with charT = char\]':
>> test.cpp:14:23: required from here
>> test.cpp:4:5: error: 'g' was not declared in this scope, and no
>> declarations were found by argument-dependent lookup at the point of
>> instantiation \[-fpermissive\]
>> test.cpp:8:6: note: 'template<class charT> void g(charT)' declared here,
>> later in the translation unit
>>
>> Liviu
Re: STDCXX-1070
Posted by Martin Sebor <ms...@gmail.com>.
On 09/25/2012 02:46 PM, Liviu Nicoara wrote:
> I filed 1070, failure to build 22.locale.collate.cpp on Linux with gcc
> 4.7.1. Gcc, Comeau and Clang fail to compile it, Intel and Sun are fine.
> It looks to me like Intel and Sun compilers are not doing the right
> thing. A small test case and a patch have been attached. The failing
> code has been reduced to:
I agree that the test case is ill-formed and requires a diagnostic.
I haven't looked at the test so just to make sure the test case does
reflect the problem there: the well-formedness depends on whether
charT is a class type. If so, then the code would be okay because g()
would be found via associated namespace lookup. I.e., this would be
fine:
template <class charT>
void f () { g (charT ()); }
template <class charT>
void g (charT) { }
struct S { };
void h () { f<S>(); }
Martin
>
> $ cat test.cpp; g++ -c test.cpp
> template < class charT >
> void f ()
> {
> g (charT ('a'));
> }
>
> template < class charT >
> void g (charT)
> {
> }
>
> int h ()
> {
> return f< char > (), 0;
> }
> test.cpp: In instantiation of 'void f() \[with charT = char\]':
> test.cpp:14:23: required from here
> test.cpp:4:5: error: 'g' was not declared in this scope, and no
> declarations were found by argument-dependent lookup at the point of
> instantiation \[-fpermissive\]
> test.cpp:8:6: note: 'template<class charT> void g(charT)' declared here,
> later in the translation unit
>
> Liviu