view gcc/testsuite/g++.dg/ext/attr-deprecated-2.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents
children
line wrap: on
line source

// Bug c++/83871 - wrong code due to attributes on distinct template
// specializations
// Test to verify that an explicit template specifialization does not
// "inherit" attribute deprecated from a primary template declared
// with it.
// { dg-do compile }
// { dg-options "-Wall -fdump-tree-optimized" }

struct Special;

template <class T>
void fdeprecated_primary ();

// The primary isn't deprecated at this point so the declaration
// of its specialization should not be diagnosed.
template <>
void fdeprecated_primary<Special> ();   // { dg-bogus "deprecated" }

template <class T>
void __attribute__ ((deprecated))
fdeprecated_primary ();

void use_primary ()
{
  // Verify that uses of the now deprecacted primary are diagnosed.
  fdeprecated_primary<void>();          // { dg-warning "deprecated" "bug 84542" { xfail *-*-* } }
  fdeprecated_primary<int>();           // { dg-warning "deprecated" "bug 84542" { xfail *-*-* } }
}

void use_special ()
{
  // Verify that the use of the non-deprecated specializatoin
  // is not diagnosed.
  fdeprecated_primary<Special>();
}