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

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

/*  PR c++/84294 - attributes on a function template redeclaration silently
    discarded
    { dg-do compile }
    { dg-options "-O -fdump-tree-optimized" } */

typedef void Func ();

template <Func>
void fail_func ();

template <Func test>
int test_func ()
{
  test ();

  // Should be eliminated.
  fail_func<test> ();

  // Expect no -Wreturn type here despite the absence of a return
  // statement in a non-void function.
}   // { dg-bogus "\\\[-Wreturn-type]" "bug 84621" { xfail *-*-* } }

void __attribute__ ((noreturn)) func_noreturn_none ();
void func_noreturn_none ();

template int test_func<func_noreturn_none>();


void func_none_noreturn ();
void  __attribute__ ((noreturn)) func_none_noreturn ();

template int test_func<func_none_noreturn>();


template <class>
void __attribute__ ((noreturn)) templ_noreturn_none ();

template <class>
void templa_noreturn_none ();

template int test_func<templ_noreturn_none<int> >();


template <class>
void templ_none_noreturn ();

template <class>
void  __attribute__ ((noreturn)) templ_none_noreturn ();

template int test_func<templ_none_noreturn<int> >();


// Verify that calls to fail_func() specializations have been eliminated.
// { dg-final { scan-tree-dump-not "fail_func" "optimized" } }