[cfe-dev] No diagnostic for C++03 14.6.4.2 ?
Nick Lewycky
nlewycky at google.com
Thu Nov 14 17:28:41 PST 2013
On 14 November 2013 14:50, Sean McBride <sean at rogue-research.com> wrote:
> Hi all,
>
> I'm not a language lawyer, but consider:
>
> ----------------------
> #include <stdio.h>
>
> static void PrintIt(double value)
> {
> printf("value is %f \n", value);
> }
>
> template <class T>
> void Function(T *value)
> {
> PrintIt(*value);
> }
>
> int main ()
> {
> int x = 1;
> Function(&x);
>
> short y = 2;
> Function(&y);
>
> return x + y;
> }
> ----------------------
>
> clang -std=c++03 -pedantic -Weverything test.cxx
>
> gives no warning/error. C++03 14.6.4.2 seems to say that, since PrintIt()
> is static, it should not be found. xlc generates an error:
>
> *The name lookup for "PrintIt" did not find a declaration.
> *Static declarations are not considered for a function call if the
> function is not qualified.
>
> Shouldn't clang be producing a diagnostic here?
>
> (If I remove the static, clang's -Wmissing-prototypes complains; and if I
> add the static, xlc complains.)
>
This is llvm.org/PR7396 which was resolved wontfix.
Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131114/c86b9805/attachment.html>
More information about the cfe-dev
mailing list