Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/g++.dg/ext/attr-nonnull.C @ 158:494b0b89df80 default tip
...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 25 May 2020 18:13:55 +0900 |
parents | 84e7813d76e9 |
children |
line wrap: on
line source
// Bug c++/83871 - wrong code due to attributes on distinct template // specializations // Test to verify that an explicit function template specifialization // does not "inherit" attribute nonnull from an argument declared with // one in the primary template. // { dg-do compile } // { dg-options "-O -Wall" } template <class T> void __attribute__ ((nonnull (1))) f (T*, T*, T*); template <> void f<int>(int*, int*, int*); // { dg-warning "may be missing attributes" } template <> void __attribute__ ((nonnull (3))) f<float>(float*, float*, float*); void test_nonnull (void) { f<void>(0, 0, 0); // { dg-warning "null argument where non-null required \\\(argument 1\\\)" } f<int>(0, 0, 0); // { dg-bogus "null argument" } f<float>(0, 0, 0); // { dg-bogus "null argument where non-null required \\\(argument 1\\\)" "" { target *-*-* } .-1 } // { dg-warning "null argument where non-null required \\\(argument 3\\\)" "" { target *-*-* } .-2 } }