Mercurial > hg > CbC > CbC_llvm
view clang/test/Sema/warn-lifetime-analysis-nocfg-disabled.cpp @ 222:81f6424ef0e3 llvm-original
LLVM original branch
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 18 Jul 2021 22:10:01 +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. }