[Bug c++/67559] New: [C++] [regression] Passing non-trivially copyable objects through '...' doesn't generate warning or error

bisqwit at iki dot fi gcc-bugzilla@gcc.gnu.org
Sat Sep 12 18:35:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67559

            Bug ID: 67559
           Summary: [C++] [regression] Passing non-trivially copyable
                    objects through '...' doesn't generate warning or
                    error
           Product: gcc
           Version: 5.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bisqwit at iki dot fi
  Target Milestone: ---

In GCC 4.9, this code generates an error. In GCC 5.2, it generates no warning
or error, even on -Wall -Wextra -pedantic.

    struct test { test(){} ~test(){} };
    void a(int, ...) {}
    int main()
    {
        test object;
        a(5, object);
    }

Tried different standards modes: -std=c++98, -std=c++03, -std=c++11, -std=c++14

Tried also lambda functions with variadic args, same result.

The error message in GCC 4.9 (and earier down to 4.6) was:

    cannot pass objects of non-trivially-copyable type 'struct test' through
'...'

In GCC 5.2, no error or warning message is given in any of the standard modes.
In the standard version C++03, this behavior is undefined (§5.2.2/7). In C++11,
it is conditionally supported with implementation-defined semantics.


More information about the Gcc-bugs mailing list