address-of-temporary.cpp revision e873fb74219f48407ae0b8fa083aa7f0b6ff1427
1e873fb74219f48407ae0b8fa083aa7f0b6ff1427Douglas Gregor// RUN: %clang_cc1 -fsyntax-only -Wno-error=address-of-temporary -verify %s 2e873fb74219f48407ae0b8fa083aa7f0b6ff1427Douglas Gregorstruct X { 3e873fb74219f48407ae0b8fa083aa7f0b6ff1427Douglas Gregor X(); 4e873fb74219f48407ae0b8fa083aa7f0b6ff1427Douglas Gregor X(int); 5e873fb74219f48407ae0b8fa083aa7f0b6ff1427Douglas Gregor X(int, int); 6e873fb74219f48407ae0b8fa083aa7f0b6ff1427Douglas Gregor}; 7e873fb74219f48407ae0b8fa083aa7f0b6ff1427Douglas Gregor 8e873fb74219f48407ae0b8fa083aa7f0b6ff1427Douglas Gregorvoid *f0() { return &X(); } // expected-warning{{taking the address of a temporary object}} 9e873fb74219f48407ae0b8fa083aa7f0b6ff1427Douglas Gregorvoid *f1() { return &X(1); } // expected-warning{{taking the address of a temporary object}} 10e873fb74219f48407ae0b8fa083aa7f0b6ff1427Douglas Gregorvoid *f2() { return &X(1, 2); } // expected-warning{{taking the address of a temporary object}} 11e873fb74219f48407ae0b8fa083aa7f0b6ff1427Douglas Gregorvoid *f3() { return &(X)1; } // expected-warning{{taking the address of a temporary object}} 12e873fb74219f48407ae0b8fa083aa7f0b6ff1427Douglas Gregor 13