[ 
https://issues.apache.org/jira/browse/STDCXX-389?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12487653#action_12487653
 ] 

sebor edited comment on STDCXX-389 at 7/31/08 11:22 AM:
---------------------------------------------------------------

Removing the const qualifier from the declaration of the formal function 
argument allows the compiler to deduce the cv-qualifiers from the actual 
argument to the call:
{noformat}
$ cat t.cpp && aCC -AA -V t.cpp
template <class T> void foo (T&) { }
template <class T> void bar (T*) { }

int main () {
    int i = 0;
    const int ci = 0;
    volatile int vi = 0;
    const volatile int cvi = 0;

    foo (i);
    foo (ci);
    foo (vi);
    foo (cvi);

    bar (&i);
    bar (&ci);
    bar (&vi);
    bar (&cvi);
}
aCC: HP ANSI C++ B3910B A.03.73
92453-07 linker command s800.sgs ld PA64 B.11.45 REL 050725
/usr/ccs/bin/ld: 92453-07 linker linker ld B.11.45 050725
{noformat}

      was (Author: sebor):
    Removing the const qualifier from the declaration of the formal function 
argument allows the compiler to deduce the cv-qualifiers from the actual 
argument to the call:

$ cat t.cpp && aCC -AA -V t.cpp
template <class T> void foo (T&) { }
template <class T> void bar (T*) { }

int main () {
    int i = 0;
    const int ci = 0;
    volatile int vi = 0;
    const volatile int cvi = 0;

    foo (i);
    foo (ci);
    foo (vi);
    foo (cvi);

    bar (&i);
    bar (&ci);
    bar (&vi);
    bar (&cvi);
}
aCC: HP ANSI C++ B3910B A.03.73
92453-07 linker command s800.sgs ld PA64 B.11.45 REL 050725
/usr/ccs/bin/ld: 92453-07 linker linker ld B.11.45 050725

  
> [HP aCC 3.73] fails to deduce volatile T
> ----------------------------------------
>
>                 Key: STDCXX-389
>                 URL: https://issues.apache.org/jira/browse/STDCXX-389
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: External
>         Environment: HP aCC 3.73
>            Reporter: Martin Sebor
>
> -------- Original Message --------
> Subject: aCC 3.73 fails to deduce volatile T
> Date: Mon, 09 Apr 2007 10:55:33 -0600
> From: Martin Sebor <[EMAIL PROTECTED]>
> Organization: Rogue Wave Software
> To: [EMAIL PROTECTED]
> The program below fails to compile with 3.73 (it compiles fine
> with the EDG-based compilers).
> Martin
> $ cat t.cpp && aCC -AA -V t.cpp
> template <class T> void foo (const T*) { }
> int main () { foo ((const volatile void*)0); }
> aCC: HP ANSI C++ B3910B A.03.73
> Error 226: "t.cpp", line 2 # No appropriate function found for call of 
> 'foo'. Last viable candidate was "void foo<void>(const void *)" 
> ["t.cpp", line 1]. Argument of type 'const volatile void *' could not be 
> converted to 'const void *'.
>     int main () { foo ((const volatile void*)0); }
>                   ^^^

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to