Skip to content

[RFE] allow assign to members of rvalue aggregate (-fpermissive) #40016

Open
@llvmbot

Description

Bugzilla Link 40670
Version unspecified
OS Linux
Reporter LLVM Bugzilla Contributor
CC @DougGregor,@zygoloid

Extended Description

#include <iostream>
#include <cstdlib>
class s {
public:
    int a;
    ~s() { std::cout << "a=" << a << std::endl; }
};
static s foo()
{
    return s{0};
}
int main()
{
    foo().a = 5;
    int *p = std::malloc(sizeof(int));
    return *p;
}

This code can be compiled with g++ if -fpermissive is used.
clang++ doesn't compile it with any options.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillac++clang:to-be-triagedShould not be used for new issuesenhancementImproving things as opposed to bug fixing, e.g. new or missing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions