Mercurial > hg > CbC > CbC_llvm
view clang/test/Sema/warn-lifetime-analysis-nocfg-disabled.cpp @ 266:00f31e85ec16 default tip
Added tag current for changeset 31d058e83c98
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 14 Oct 2023 10:13:55 +0900 |
parents | 1d019706d866 |
children |
line wrap: on
line source
// RUN: %clang_cc1 -fsyntax-only -Wno-dangling-gsl -Wreturn-stack-address -verify %s struct [[gsl::Owner(int)]] MyIntOwner { MyIntOwner(); int &operator*(); }; struct [[gsl::Pointer(int)]] MyIntPointer { MyIntPointer(int *p = nullptr); MyIntPointer(const MyIntOwner &); int &operator*(); MyIntOwner toOwner(); }; int &f() { int i; return i; // expected-warning {{reference to stack memory associated with local variable 'i' returned}} } MyIntPointer g() { MyIntOwner o; return o; // No warning, it is disabled. }