[LLVMbugs] [Bug 13808] New: -Wdangling-field warning should check in-class initializers

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Sep 10 10:57:13 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=13808

             Bug #: 13808
           Summary: -Wdangling-field warning should check in-class
                    initializers
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: richard-llvm at metafoo.co.uk
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


struct S { const int &a; S() : a(0) {} } s;                                     
struct T { const int &a = 0; } t;

produces:

<stdin>:1:34: warning: binding reference member 'a' to a temporary value
[-Wdangling-field]
struct S { const int &a; S() : a(0) {} } s;
                                 ^
<stdin>:1:23: note: reference member declared here
struct S { const int &a; S() : a(0) {} } s;
                      ^

We should also issue a diagnostic for the in-class initializer case.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list